[llvm] r303704 - [LIR] Use the newly `getRecurrenceVar()` helper. NFCI.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 16:51:55 PDT 2017


Author: davide
Date: Tue May 23 18:51:54 2017
New Revision: 303704

URL: http://llvm.org/viewvc/llvm-project?rev=303704&view=rev
Log:
[LIR] Use the newly `getRecurrenceVar()` helper. NFCI.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=303704&r1=303703&r2=303704&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Tue May 23 18:51:54 2017
@@ -1139,8 +1139,8 @@ static bool detectPopcountIdiom(Loop *Cu
       if (!Inc || !Inc->isOne())
         continue;
 
-      PHINode *Phi = dyn_cast<PHINode>(Inst->getOperand(0));
-      if (!Phi || Phi->getParent() != LoopEntry)
+      PHINode *Phi = getRecurrenceVar(Inst->getOperand(0), Inst, LoopEntry);
+      if (!Phi)
         continue;
 
       // Check if the result of the instruction is live of the loop.
@@ -1255,8 +1255,8 @@ static bool detectCTLZIdiom(Loop *CurLoo
     if (!Inc || !Inc->isOne())
       continue;
 
-    PHINode *Phi = dyn_cast<PHINode>(Inst->getOperand(0));
-    if (!Phi || Phi->getParent() != LoopEntry)
+    PHINode *Phi = getRecurrenceVar(Inst->getOperand(0), Inst, LoopEntry);
+    if (!Phi)
       continue;
 
     CntInst = Inst;




More information about the llvm-commits mailing list