diff options
author | Alexis Engelke <engelke@in.tum.de> | 2024-08-02 14:06:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 14:06:36 +0200 |
commit | 1525abb9c94e7daa9295323b6649e289e0e91c7a (patch) | |
tree | 4416d86904dfd6a45cd023b5e68497383709f715 /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | db1375f6d907f1af34c03b5174b7e0432f615d21 (diff) | |
download | llvm-1525abb9c94e7daa9295323b6649e289e0e91c7a.zip llvm-1525abb9c94e7daa9295323b6649e289e0e91c7a.tar.gz llvm-1525abb9c94e7daa9295323b6649e289e0e91c7a.tar.bz2 |
[FastISel] Don't use sizeWithoutDebug() for debug records (#101648)
sizeWithoutDebug() iterates over the entire block, but all we do is to
check whether the number is not equal to one. In times of debug records,
simply check whether the first and last instructions are equal.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index e255bba..ce697a7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -86,6 +86,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Mangler.h" #include "llvm/IR/Metadata.h" +#include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/IR/PatternMatch.h" #include "llvm/IR/Type.h" @@ -1664,8 +1665,12 @@ bool FastISel::selectInstruction(const Instruction *I) { /// (fall-through) successor, and update the CFG. void FastISel::fastEmitBranch(MachineBasicBlock *MSucc, const DebugLoc &DbgLoc) { - if (FuncInfo.MBB->getBasicBlock()->sizeWithoutDebug() > 1 && - FuncInfo.MBB->isLayoutSuccessor(MSucc)) { + const BasicBlock *BB = FuncInfo.MBB->getBasicBlock(); + bool BlockHasMultipleInstrs = &BB->front() != &BB->back(); + // Handle legacy case of debug intrinsics + if (BlockHasMultipleInstrs && !BB->getModule()->IsNewDbgInfoFormat) + BlockHasMultipleInstrs = BB->sizeWithoutDebug() > 1; + if (BlockHasMultipleInstrs && FuncInfo.MBB->isLayoutSuccessor(MSucc)) { // For more accurate line information if this is the only non-debug // instruction in the block then emit it, otherwise we have the // unconditional fall-through case, which needs no instructions. |