diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-04-08 05:09:48 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-04-08 05:09:48 +0000 |
| commit | a93b4b5866dba96e0e72852bf0047d70128f5673 (patch) | |
| tree | 776aceb329f1f2db375dd668cfcab8d5a7864478 /llvm/lib | |
| parent | 93564892669cee8da641976a10f23294ae918d16 (diff) | |
| download | bcm5719-llvm-a93b4b5866dba96e0e72852bf0047d70128f5673.tar.gz bcm5719-llvm-a93b4b5866dba96e0e72852bf0047d70128f5673.zip | |
Add constant replacement for insertelement/vectorshuffle constant exprs
llvm-svn: 27532
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 9f706b9bc1b..22a14fb14ef 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -1702,6 +1702,22 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV, if (C1 == From) C1 = To; if (C2 == From) C2 = To; Replacement = ConstantExpr::getExtractElement(C1, C2); + } else if (getOpcode() == Instruction::InsertElement) { + Constant *C1 = getOperand(0); + Constant *C2 = getOperand(1); + Constant *C3 = getOperand(1); + if (C1 == From) C1 = To; + if (C2 == From) C2 = To; + if (C3 == From) C3 = To; + Replacement = ConstantExpr::getInsertElement(C1, C2, C3); + } else if (getOpcode() == Instruction::ShuffleVector) { + 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::getShuffleVector(C1, C2, C3); } else if (getNumOperands() == 2) { Constant *C1 = getOperand(0); Constant *C2 = getOperand(1); |

