]> granicus.if.org Git - llvm/commitdiff
The patch fixes PR35131
authorEvgeny Stupachenko <evstupac@gmail.com>
Fri, 3 Nov 2017 18:50:03 +0000 (18:50 +0000)
committerEvgeny Stupachenko <evstupac@gmail.com>
Fri, 3 Nov 2017 18:50:03 +0000 (18:50 +0000)
Summary:

Fix a misprint which led to false CTLZ recognition.

Reviewers: craig.topper

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

From: Evgeny Stupachenko <evstupac@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317348 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopIdiomRecognize.cpp

index 413fb75d1725d62e29ea4a3cc45f8f3f97a89a46..eb5f3cc47cef83266f9477c8f16e663458c05008 100644 (file)
@@ -1326,9 +1326,9 @@ static bool detectCTLZIdiom(Loop *CurLoop, PHINode *&PhiX,
   // step 2: detect instructions corresponding to "x.next = x >> 1"
   if (!DefX || DefX->getOpcode() != Instruction::AShr)
     return false;
-  if (ConstantInt *Shft = dyn_cast<ConstantInt>(DefX->getOperand(1)))
-    if (!Shft || !Shft->isOne())
-      return false;
+  ConstantInt *Shft = dyn_cast<ConstantInt>(DefX->getOperand(1));
+  if (!Shft || !Shft->isOne())
+    return false;
   VarX = DefX->getOperand(0);
 
   // step 3: Check the recurrence of variable X