[llvm] a80232b - [LTT] Address post-review comments (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 13 16:00:22 PST 2021


Author: Teresa Johnson
Date: 2021-02-13T15:52:59-08:00
New Revision: a80232bd5f125ab81554882825a564bdc7ab8e0c

URL: https://github.com/llvm/llvm-project/commit/a80232bd5f125ab81554882825a564bdc7ab8e0c
DIFF: https://github.com/llvm/llvm-project/commit/a80232bd5f125ab81554882825a564bdc7ab8e0c.diff

LOG: [LTT] Address post-review comments (NFC)

Implement some post-review cleanup suggestions for D96083.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index adbf6e51e374..de23456a5347 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1791,13 +1791,10 @@ bool LowerTypeTestsModule::lower() {
          UI != UE;) {
       auto *CI = cast<CallInst>((*UI++).getUser());
       // Find and erase llvm.assume intrinsics for this llvm.type.test call.
-      for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;) {
-        if (auto *AssumeCI = dyn_cast<CallInst>((*CIU++).getUser())) {
-          Function *F = AssumeCI->getCalledFunction();
-          if (F && F->getIntrinsicID() == Intrinsic::assume)
-            AssumeCI->eraseFromParent();
-        }
-      }
+      for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;)
+        if (auto *II = dyn_cast<IntrinsicInst>((*CIU++).getUser()))
+          if (II->getIntrinsicID() == Intrinsic::assume)
+            II->eraseFromParent();
       CI->eraseFromParent();
     }
 
@@ -2065,12 +2062,10 @@ bool LowerTypeTestsModule::lower() {
       // unnecessarily. These will be removed by a subsequent LTT invocation
       // with the DropTypeTests flag set.
       bool OnlyAssumeUses = !CI->use_empty();
-      for (auto CIU = CI->use_begin(), CIUE = CI->use_end(); CIU != CIUE;) {
-        if (auto *AssumeCI = dyn_cast<CallInst>((*CIU++).getUser())) {
-          Function *F = AssumeCI->getCalledFunction();
-          if (F && F->getIntrinsicID() == Intrinsic::assume)
+      for (const Use &CIU : CI->uses()) {
+        if (auto *II = dyn_cast<IntrinsicInst>(CIU.getUser()))
+          if (II->getIntrinsicID() == Intrinsic::assume)
             continue;
-        }
         OnlyAssumeUses = false;
         break;
       }


        


More information about the llvm-commits mailing list