[PATCH] D39585: PR35131 Fix a misprint in CTLZ recognition

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 18:09:45 PDT 2017


evstupac created this revision.

Before the patch LLVM include shifts on a register when recognize CTLZ loops.
The patch makes it only shift on a constant 1.

Since this is clear misprint I don't add any new lit test.


Repository:
  rL LLVM

https://reviews.llvm.org/D39585

Files:
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp


Index: lib/Transforms/Scalar/LoopIdiomRecognize.cpp
===================================================================
--- lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1326,9 +1326,9 @@
   // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39585.121425.patch
Type: text/x-patch
Size: 710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/ff4829b5/attachment.bin>


More information about the llvm-commits mailing list