mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
Fix CFG building issue.
Summary: Fixed getBasicBlockContainingOffset() to return correct basic block. (cherry picked from FBD2532514)
This commit is contained in:
@@ -31,6 +31,22 @@ namespace llvm {
|
||||
|
||||
namespace flo {
|
||||
|
||||
BinaryBasicBlock *
|
||||
BinaryFunction::getBasicBlockContainingOffset(uint64_t Offset) {
|
||||
if (Offset > Size)
|
||||
return nullptr;
|
||||
|
||||
if (BasicBlocks.empty())
|
||||
return nullptr;
|
||||
|
||||
auto I = std::upper_bound(BasicBlocks.begin(),
|
||||
BasicBlocks.end(),
|
||||
BinaryBasicBlock(Offset));
|
||||
assert(I != BasicBlocks.begin() && "first basic block not at offset 0");
|
||||
|
||||
return &(*--I);
|
||||
}
|
||||
|
||||
void BinaryFunction::print(raw_ostream &OS, bool PrintInstructions) const {
|
||||
StringRef SectionName;
|
||||
Section.getName(SectionName);
|
||||
|
||||
Reference in New Issue
Block a user