[llvm] r344716 - [TI removal] Update CodeExtractor to use Instruction directly.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 17:38:54 PDT 2018


Author: chandlerc
Date: Wed Oct 17 17:38:54 2018
New Revision: 344716

URL: http://llvm.org/viewvc/llvm-project?rev=344716&view=rev
Log:
[TI removal] Update CodeExtractor to use Instruction directly.

Modified:
    llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp

Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=344716&r1=344715&r2=344716&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Wed Oct 17 17:38:54 2018
@@ -808,10 +808,10 @@ Function *CodeExtractor::constructFuncti
   for (unsigned i = 0, e = Users.size(); i != e; ++i)
     // The BasicBlock which contains the branch is not in the region
     // modify the branch target to a new block
-    if (TerminatorInst *TI = dyn_cast<TerminatorInst>(Users[i]))
-      if (!Blocks.count(TI->getParent()) &&
-          TI->getParent()->getParent() == oldFunction)
-        TI->replaceUsesOfWith(header, newHeader);
+    if (Instruction *I = dyn_cast<Instruction>(Users[i]))
+      if (I->isTerminator() && !Blocks.count(I->getParent()) &&
+          I->getParent()->getParent() == oldFunction)
+        I->replaceUsesOfWith(header, newHeader);
 
   return newFunction;
 }




More information about the llvm-commits mailing list