[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Apr 7 22:10:00 PDT 2006
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.149 -> 1.150
---
Log message:
Add constant replacement for insertelement/vectorshuffle constant exprs
---
Diffs of the changes: (+16 -0)
Constants.cpp | 16 ++++++++++++++++
1 files changed, 16 insertions(+)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.149 llvm/lib/VMCore/Constants.cpp:1.150
--- llvm/lib/VMCore/Constants.cpp:1.149 Fri Apr 7 20:18:18 2006
+++ llvm/lib/VMCore/Constants.cpp Sat Apr 8 00:09:48 2006
@@ -1702,6 +1702,22 @@
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);
More information about the llvm-commits
mailing list