diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-05 19:53:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-05 19:53:03 +0000 |
commit | 29e3b2ba77e487cd595185ad11dbba71c45fb42f (patch) | |
tree | b1f00119f5a64664af8b1c3b9d5b570be258907d /lib/VMCore/Constants.cpp | |
parent | 80f0b57b5d101f5b52d803c570dc74cca47e53f9 (diff) |
Add support for constant expr shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r-- | lib/VMCore/Constants.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index bc1e9d2c1c..28cc9d24e0 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -493,6 +493,13 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV, } 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); |