diff options
author | Vitaly Buka <vitalybuka@google.com> | 2024-04-01 00:42:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 00:42:18 -0700 |
commit | c0cabfbdaf547b1152065be5419bc48e0b83b761 (patch) | |
tree | a9f9cedf72180ec186cf63dc108bcd74e26c60f5 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 8b135a7d1f59a5a7adccb162abf92d751209afe7 (diff) | |
download | llvm-c0cabfbdaf547b1152065be5419bc48e0b83b761.zip llvm-c0cabfbdaf547b1152065be5419bc48e0b83b761.tar.gz llvm-c0cabfbdaf547b1152065be5419bc48e0b83b761.tar.bz2 |
[InstCombiner] Remove trivially dead `llvm.allow.{runtime,ubsan}.check()` (#84851)
Intrinsic declared to have sideeffects, but it's done only to prevent
moving it. Removing unused ones is OK.
Exacted from #84850 for easier review.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 3d3b97e..380bac9 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -475,6 +475,12 @@ bool llvm::wouldInstructionBeTriviallyDead(const Instruction *I, II->getIntrinsicID() == Intrinsic::launder_invariant_group) return true; + // Intrinsics declare sideeffects to prevent them from moving, but they are + // nops without users. + if (II->getIntrinsicID() == Intrinsic::allow_runtime_check || + II->getIntrinsicID() == Intrinsic::allow_ubsan_check) + return true; + if (II->isLifetimeStartOrEnd()) { auto *Arg = II->getArgOperand(1); // Lifetime intrinsics are dead when their right-hand is undef. |