[llvm] r274995 - [SCCP] Remove wrong and misleading vector handling code.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 9 15:49:35 PDT 2016
Author: davide
Date: Sat Jul 9 17:49:35 2016
New Revision: 274995
URL: http://llvm.org/viewvc/llvm-project?rev=274995&view=rev
Log:
[SCCP] Remove wrong and misleading vector handling code.
This code was already commented out and it made some weird assumptions,
e.g. using isUndefined() as "this value is UndefValue" instead of
"we haven't computed this value is yet". Thanks to Eli Friedman for
pointing out where I was wrong (and where this code was wrong).
Modified:
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=274995&r1=274994&r2=274995&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Sat Jul 9 17:49:35 2016
@@ -948,69 +948,16 @@ void SCCPSolver::visitCmpInst(CmpInst &I
void SCCPSolver::visitExtractElementInst(ExtractElementInst &I) {
// TODO : SCCP does not handle vectors properly.
return markOverdefined(&I);
-
-#if 0
- LatticeVal &ValState = getValueState(I.getOperand(0));
- LatticeVal &IdxState = getValueState(I.getOperand(1));
-
- if (ValState.isOverdefined() || IdxState.isOverdefined())
- markOverdefined(&I);
- else if(ValState.isConstant() && IdxState.isConstant())
- markConstant(&I, ConstantExpr::getExtractElement(ValState.getConstant(),
- IdxState.getConstant()));
-#endif
}
void SCCPSolver::visitInsertElementInst(InsertElementInst &I) {
// TODO : SCCP does not handle vectors properly.
return markOverdefined(&I);
-#if 0
- LatticeVal &ValState = getValueState(I.getOperand(0));
- LatticeVal &EltState = getValueState(I.getOperand(1));
- LatticeVal &IdxState = getValueState(I.getOperand(2));
-
- if (ValState.isOverdefined() || EltState.isOverdefined() ||
- IdxState.isOverdefined())
- markOverdefined(&I);
- else if(ValState.isConstant() && EltState.isConstant() &&
- IdxState.isConstant())
- markConstant(&I, ConstantExpr::getInsertElement(ValState.getConstant(),
- EltState.getConstant(),
- IdxState.getConstant()));
- else if (ValState.isUndefined() && EltState.isConstant() &&
- IdxState.isConstant())
- markConstant(&I,ConstantExpr::getInsertElement(UndefValue::get(I.getType()),
- EltState.getConstant(),
- IdxState.getConstant()));
-#endif
}
void SCCPSolver::visitShuffleVectorInst(ShuffleVectorInst &I) {
// TODO : SCCP does not handle vectors properly.
return markOverdefined(&I);
-#if 0
- 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));
- }
-#endif
}
// Handle getelementptr instructions. If all operands are constants then we
More information about the llvm-commits
mailing list