[llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Apr 7 18:19:27 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
SCCP.cpp updated: 1.129 -> 1.130
---
Log message:
Add supprot for shufflevector
---
Diffs of the changes: (+25 -0)
SCCP.cpp | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+)
Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.129 llvm/lib/Transforms/Scalar/SCCP.cpp:1.130
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.129 Tue Feb 7 20:38:11 2006
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Apr 7 20:19:12 2006
@@ -330,6 +330,7 @@
void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
void visitExtractElementInst(ExtractElementInst &I);
void visitInsertElementInst(InsertElementInst &I);
+ void visitShuffleVectorInst(ShuffleVectorInst &I);
// Instructions that cannot be folded away...
void visitStoreInst (Instruction &I);
@@ -782,6 +783,30 @@
IdxState.getConstant()));
}
+void SCCPSolver::visitShuffleVectorInst(ShuffleVectorInst &I) {
+ LatticeVal &V1State = getValueState(I.getOperand(0));
+ LatticeVal &V2State = getValueState(I.getOperand(1));
+ LatticeVal &MaskState = getValueState(I.getOperand(2));
+
+ if (MaskState.isUndefined() ||
+ (V1State.isUndefined() && V2State.isUndefined()))
+ return; // Undefined output if mask or both inputs undefined.
+
+ if (V1State.isOverdefined() || V2State.isOverdefined() ||
+ MaskState.isOverdefined()) {
+ markOverdefined(&I);
+ } else {
+ // A mix of constant/undef inputs.
+ Constant *V1 = V1State.isConstant() ?
+ V1State.getConstant() : UndefValue::get(I.getType());
+ Constant *V2 = V2State.isConstant() ?
+ V2State.getConstant() : UndefValue::get(I.getType());
+ Constant *Mask = MaskState.isConstant() ?
+ MaskState.getConstant() : UndefValue::get(I.getOperand(2)->getType());
+ markConstant(&I, ConstantExpr::getShuffleVector(V1, V2, Mask));
+ }
+}
+
// Handle getelementptr instructions... if all operands are constants then we
// can turn this into a getelementptr ConstantExpr.
//
More information about the llvm-commits
mailing list