[llvm] a49dae0 - [Attributor][AAIsDead][NFC] Skip uninteresting instructions early
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 23:47:58 PDT 2020
Author: Johannes Doerfert
Date: 2020-08-20T01:44:58-05:00
New Revision: a49dae0e38b61aff294a70829eba0b4ef47f7bb5
URL: https://github.com/llvm/llvm-project/commit/a49dae0e38b61aff294a70829eba0b4ef47f7bb5
DIFF: https://github.com/llvm/llvm-project/commit/a49dae0e38b61aff294a70829eba0b4ef47f7bb5.diff
LOG: [Attributor][AAIsDead][NFC] Skip uninteresting instructions early
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index a154ff45bae8..8043de6e0d40 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3292,18 +3292,23 @@ ChangeStatus AAIsDeadFunction::updateImpl(Attributor &A) {
const Instruction *I = Worklist.pop_back_val();
LLVM_DEBUG(dbgs() << "[AAIsDead] Exploration inst: " << *I << "\n");
+ // Fast forward for uninteresting instructions. We could look for UB here
+ // though.
+ while(!I->isTerminator() && !isa<CallBase>(I)) {
+ Change = ChangeStatus::CHANGED;
+ I = I->getNextNode();
+ }
+
AliveSuccessors.clear();
bool UsedAssumedInformation = false;
switch (I->getOpcode()) {
// TODO: look for (assumed) UB to backwards propagate "deadness".
default:
- if (I->isTerminator()) {
- for (const BasicBlock *SuccBB : successors(I->getParent()))
- AliveSuccessors.push_back(&SuccBB->front());
- } else {
- AliveSuccessors.push_back(I->getNextNode());
- }
+ assert(I->isTerminator() &&
+ "Expected non-terminators to be handled already!");
+ for (const BasicBlock *SuccBB : successors(I->getParent()))
+ AliveSuccessors.push_back(&SuccBB->front());
break;
case Instruction::Call:
UsedAssumedInformation = identifyAliveSuccessors(A, cast<CallInst>(*I),
More information about the llvm-commits
mailing list