diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-31 02:56:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-31 02:56:11 +0000 |
commit | 467cb2bc5d9b0d4ed8e5013b6314d6da2dab54ec (patch) | |
tree | 899c4f8a0f89794427f7e67325a318e1a02a1d23 | |
parent | 974efc72beb3d9f838579eb73fc16736ac97fee5 (diff) | |
download | bcm5719-llvm-467cb2bc5d9b0d4ed8e5013b6314d6da2dab54ec.tar.gz bcm5719-llvm-467cb2bc5d9b0d4ed8e5013b6314d6da2dab54ec.zip |
Add support for constant expr casts
llvm-svn: 12564
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index f29f3157c8e..6c6557dccde 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -571,6 +571,14 @@ 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::Select) { + Constant *C1 = getOperand(0); + Constant *C2 = getOperand(1); + Constant *C3 = getOperand(2); + if (C1 == From) C1 = To; + if (C2 == From) C2 = To; + if (C3 == From) C3 = To; + Replacement = ConstantExpr::getSelect(C1, C2, C3); } else if (getNumOperands() == 2) { Constant *C1 = getOperand(0); Constant *C2 = getOperand(1); |