[llvm-commits] [llvm] r58820 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp Transforms/Scalar/InstructionCombining.cpp
Mon P Wang
wangmp at apple.com
Thu Nov 6 14:52:22 PST 2008
Author: wangmp
Date: Thu Nov 6 16:52:21 2008
New Revision: 58820
URL: http://llvm.org/viewvc/llvm-project?rev=58820&view=rev
Log:
Fixed scalarizing an extract subvector and prevent an infinite loop
when simplify a vector.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=58820&r1=58819&r2=58820&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Nov 6 16:52:21 2008
@@ -7516,8 +7516,8 @@
break;
}
case ISD::EXTRACT_SUBVECTOR:
- Result = Node->getOperand(0);
- assert(Result.getValueType() == NewVT);
+ Result = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, NewVT, Node->getOperand(0),
+ Node->getOperand(1));
break;
case ISD::BIT_CONVERT: {
SDValue Op0 = Op.getOperand(0);
@@ -8174,7 +8174,7 @@
SDValue VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, ValOp);
SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp,
- DAG.getIntPtrConstant(0));
+ DAG.getIntPtrConstant(0));
SDValue StOp = DAG.getStore(Chain, EOp, BasePtr, SV, SVOffset,
isVolatile, Alignment);
StChain.push_back(StOp);
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58820&r1=58819&r2=58820&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 6 16:52:21 2008
@@ -1410,6 +1410,12 @@
} else if (isa<ConstantAggregateZero>(V)) {
// Simplify the CAZ to a ConstantVector where the non-demanded elements are
// set to undef.
+
+ // Check if this is identity. If so, return 0 since we are not simplifying
+ // anything.
+ if (DemandedElts == ((1ULL << VWidth) -1))
+ return 0;
+
const Type *EltTy = cast<VectorType>(V->getType())->getElementType();
Constant *Zero = Constant::getNullValue(EltTy);
Constant *Undef = UndefValue::get(EltTy);
More information about the llvm-commits
mailing list