Skip to content

Commit b686e35

Browse files
committed
Only check opcode in find_if
1 parent 057abc8 commit b686e35

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7575,13 +7575,8 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
75757575
if (C->isNullValue() || isa<UndefValue>(C)) {
75767576
// Only look at the first use we can handle, avoid hurting compile time with
75777577
// long uselists
7578-
auto FindUse = llvm::find_if(I->users(), [&I](auto *U) {
7578+
auto FindUse = llvm::find_if(I->users(), [](auto *U) {
75797579
auto *Use = cast<Instruction>(U);
7580-
// Bail out if Use is not in the same BB as I or Use == I or Use comes
7581-
// before I in the block. The latter two can be the case if Use is a
7582-
// PHI node.
7583-
if (Use->getParent() != I->getParent() || Use == I || Use->comesBefore(I))
7584-
return false;
75857580
// Change this list when we want to add new instructions.
75867581
switch (Use->getOpcode()) {
75877582
default:
@@ -7600,6 +7595,11 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
76007595
if (FindUse == I->user_end())
76017596
return false;
76027597
auto *Use = cast<Instruction>(*FindUse);
7598+
// Bail out if Use is not in the same BB as I or Use == I or Use comes
7599+
// before I in the block. The latter two can be the case if Use is a
7600+
// PHI node.
7601+
if (Use->getParent() != I->getParent() || Use == I || Use->comesBefore(I))
7602+
return false;
76037603

76047604
// Now make sure that there are no instructions in between that can alter
76057605
// control flow (eg. calls)

0 commit comments

Comments
 (0)