[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Nov 5 13:54:09 PST 2003
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.60 -> 1.61
---
Log message:
Add support for constant expr shifts
---
Diffs of the changes: (+7 -0)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.60 llvm/lib/VMCore/Constants.cpp:1.61
--- llvm/lib/VMCore/Constants.cpp:1.60 Thu Oct 23 00:21:48 2003
+++ llvm/lib/VMCore/Constants.cpp Wed Nov 5 13:52:52 2003
@@ -493,6 +493,13 @@
} else if (getOpcode() == Instruction::Cast) {
assert(getOperand(0) == From && "Cast only has one use!");
Replacement = ConstantExpr::getCast(To, getType());
+ } else if (getOpcode() == Instruction::Shl ||
+ getOpcode() == Instruction::Shr) {
+ Constant *C1 = getOperand(0);
+ Constant *C2 = getOperand(1);
+ if (C1 == From) C1 = To;
+ if (C2 == From) C2 = To;
+ Replacement = ConstantExpr::getShift(getOpcode(), C1, C2);
} else if (getNumOperands() == 2) {
Constant *C1 = getOperand(0);
Constant *C2 = getOperand(1);
More information about the llvm-commits
mailing list