diff options
author | Nikita Popov <npopov@redhat.com> | 2023-08-23 15:04:45 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-08-25 09:20:18 +0200 |
commit | 4eafc9b6ff4ae2bce82e9fdf0123b336825d931c (patch) | |
tree | 0319c1949af24b0568f4e9f891242082d691a8f6 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 01b2554ff4defce979b16d794c13ea99f2e2c155 (diff) | |
download | llvm-4eafc9b6ff4ae2bce82e9fdf0123b336825d931c.zip llvm-4eafc9b6ff4ae2bce82e9fdf0123b336825d931c.tar.gz llvm-4eafc9b6ff4ae2bce82e9fdf0123b336825d931c.tar.bz2 |
[IR] Treat callbr as special terminator (PR64215)
isLegalToHoistInto() currently return true for callbr instructions.
That means that a callbr with one successor will be considered a
proper loop preheader, which may result in instructions that use
the callbr return value being hoisted past it.
Fix this by adding callbr to isExceptionTerminator (with a rename
to isSpecialTerminator), which also fixes similar assumptions in
other places.
Fixes https://github.com/llvm/llvm-project/issues/64215.
Differential Revision: https://reviews.llvm.org/D158609
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 6b956a1..7edb4e9 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -194,7 +194,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU, // Don't break unwinding instructions or terminators with other side-effects. Instruction *PTI = PredBB->getTerminator(); - if (PTI->isExceptionalTerminator() || PTI->mayHaveSideEffects()) + if (PTI->isSpecialTerminator() || PTI->mayHaveSideEffects()) return false; // Can't merge if there are multiple distinct successors. |