@@ -1791,13 +1791,10 @@ bool LowerTypeTestsModule::lower() {
1791
1791
UI != UE;) {
1792
1792
auto *CI = cast<CallInst>((*UI++).getUser ());
1793
1793
// 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 ();
1801
1798
CI->eraseFromParent ();
1802
1799
}
1803
1800
@@ -2065,12 +2062,10 @@ bool LowerTypeTestsModule::lower() {
2065
2062
// unnecessarily. These will be removed by a subsequent LTT invocation
2066
2063
// with the DropTypeTests flag set.
2067
2064
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)
2072
2068
continue ;
2073
- }
2074
2069
OnlyAssumeUses = false ;
2075
2070
break ;
2076
2071
}
0 commit comments