[llvm] 9c7d917 - [CallSite removal][CodeGen] Remove CallSite use from BasicTTIImpl.h. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 10:57:39 PDT 2020


Author: Craig Topper
Date: 2020-04-16T10:56:43-07:00
New Revision: 9c7d917701f9c68ca0e41a321cb5de4e4c043f08

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

LOG: [CallSite removal][CodeGen] Remove CallSite use from BasicTTIImpl.h. NFC

While there convert iterator loops to range-based.

Differential Revision: https://reviews.llvm.org/D78275

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 4822abc46300..7646c2196941 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -29,7 +29,6 @@
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/CodeGen/ValueTypes.h"
 #include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/CallSite.h"
 #include "llvm/IR/Constant.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
@@ -479,20 +478,17 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
       return;
 
     // Scan the loop: don't unroll loops with calls.
-    for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); I != E;
-         ++I) {
-      BasicBlock *BB = *I;
-
-      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J)
-        if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
-          ImmutableCallSite CS(&*J);
-          if (const Function *F = CS.getCalledFunction()) {
+    for (BasicBlock *BB : L->blocks()) {
+      for (Instruction &I : *BB) {
+        if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
+          if (const Function *F = cast<CallBase>(I).getCalledFunction()) {
             if (!static_cast<T *>(this)->isLoweredToCall(F))
               continue;
           }
 
           return;
         }
+      }
     }
 
     // Enable runtime and partial unrolling up to the specified size.


        


More information about the llvm-commits mailing list