[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Chris Lattner sabre at nondot.org
Sun Apr 1 22:41:56 PDT 2007



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.105 -> 1.106
---
Log message:

Treat xor of signbit like an add.


---
Diffs of the changes:  (+10 -1)

 ScalarEvolution.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.105 llvm/lib/Analysis/ScalarEvolution.cpp:1.106
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.105	Sat Mar  3 19:25:35 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Mon Apr  2 00:41:38 2007
@@ -1427,7 +1427,16 @@
         }
       }
       break;
-      
+    case Instruction::Xor:
+      // If the RHS of the xor is a signbit, then this is just an add.
+      // Instcombine turns add of signbit into xor as a strength reduction step.
+      if (ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1))) {
+        if (CI->getValue().isSignBit())
+          return SCEVAddExpr::get(getSCEV(I->getOperand(0)),
+                                  getSCEV(I->getOperand(1)));
+      }
+      break;
+
     case Instruction::Shl:
       // Turn shift left of a constant amount into a multiply.
       if (ConstantInt *SA = dyn_cast<ConstantInt>(I->getOperand(1))) {






More information about the llvm-commits mailing list