Skip to content

Commit a80232b

Browse files
committed
[LTT] Address post-review comments (NFC)
Implement some post-review cleanup suggestions for D96083.
1 parent 74ddacd commit a80232b

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,13 +1791,10 @@ bool LowerTypeTestsModule::lower() {
17911791
UI != UE;) {
17921792
auto *CI = cast<CallInst>((*UI++).getUser());
17931793
// Find and erase llvm.assume intrinsics for this llvm.type.test call.
1794-
for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;) {
1795-
if (auto *AssumeCI = dyn_cast<CallInst>((*CIU++).getUser())) {
1796-
Function *F = AssumeCI->getCalledFunction();
1797-
if (F && F->getIntrinsicID() == Intrinsic::assume)
1798-
AssumeCI->eraseFromParent();
1799-
}
1800-
}
1794+
for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;)
1795+
if (auto *II = dyn_cast<IntrinsicInst>((*CIU++).getUser()))
1796+
if (II->getIntrinsicID() == Intrinsic::assume)
1797+
II->eraseFromParent();
18011798
CI->eraseFromParent();
18021799
}
18031800

@@ -2065,12 +2062,10 @@ bool LowerTypeTestsModule::lower() {
20652062
// unnecessarily. These will be removed by a subsequent LTT invocation
20662063
// with the DropTypeTests flag set.
20672064
bool OnlyAssumeUses = !CI->use_empty();
2068-
for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;) {
2069-
if (auto *AssumeCI = dyn_cast<CallInst>((*CIU++).getUser())) {
2070-
Function *F = AssumeCI->getCalledFunction();
2071-
if (F && F->getIntrinsicID() == Intrinsic::assume)
2065+
for (const Use &CIU : CI->uses()) {
2066+
if (auto *II = dyn_cast<IntrinsicInst>(CIU.getUser()))
2067+
if (II->getIntrinsicID() == Intrinsic::assume)
20722068
continue;
2073-
}
20742069
OnlyAssumeUses = false;
20752070
break;
20762071
}

0 commit comments

Comments
 (0)