[llvm] r236954 - [SelectionDAG] Fixed constant folding issue when legalised types are smaller then the folded type.
Simon Pilgrim
llvm-dev at redking.me.uk
Sun May 10 07:14:52 PDT 2015
Author: rksimon
Date: Sun May 10 09:14:51 2015
New Revision: 236954
URL: http://llvm.org/viewvc/llvm-project?rev=236954&view=rev
Log:
[SelectionDAG] Fixed constant folding issue when legalised types are smaller then the folded type.
Found when testing with llvm-stress on i686 targets.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=236954&r1=236953&r2=236954&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun May 10 09:14:51 2015
@@ -2872,11 +2872,12 @@ SDValue SelectionDAG::getNode(unsigned O
EVT InVT = BV->getValueType(0);
EVT InSVT = InVT.getScalarType();
- // Find legal integer scalar type for constant promotion.
+ // Find legal integer scalar type for constant promotion and
+ // ensure that its scalar size is at least as large as source.
EVT LegalSVT = SVT;
if (SVT.isInteger()) {
LegalSVT = TLI->getTypeToTransformTo(*getContext(), SVT);
- assert(LegalSVT.bitsGE(SVT) && "Unexpected legal scalar type size");
+ if (LegalSVT.bitsLT(SVT)) break;
}
// Let the above scalar folding handle the folding of each element.
More information about the llvm-commits
mailing list