forked from OSchip/llvm-project
[SelectionDAG] Fixed constant folding issue when legalised types are smaller then the folded type.
Found when testing with llvm-stress on i686 targets. llvm-svn: 236954
This commit is contained in:
parent
c34f847b80
commit
e09584ca95
|
@ -2872,11 +2872,12 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue