[llvm] r238503 - [SelectionDAG] Scalar shift amounts may require legalization
David Majnemer
david.majnemer at gmail.com
Thu May 28 14:29:59 PDT 2015
Author: majnemer
Date: Thu May 28 16:29:59 2015
New Revision: 238503
URL: http://llvm.org/viewvc/llvm-project?rev=238503&view=rev
Log:
[SelectionDAG] Scalar shift amounts may require legalization
The shift amount may be too small to cope with promoted left hand side,
make sure to promote it as well.
This fixes PR23664.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=238503&r1=238502&r2=238503&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Thu May 28 16:29:59 2015
@@ -604,7 +604,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_
SDValue DAGTypeLegalizer::PromoteIntRes_SHL(SDNode *N) {
SDValue Res = GetPromotedInteger(N->getOperand(0));
SDValue Amt = N->getOperand(1);
- Amt = Amt.getValueType().isVector() ? ZExtPromotedInteger(Amt) : Amt;
+ if (!TLI.isTypeLegal(Amt.getValueType()))
+ Amt = ZExtPromotedInteger(N->getOperand(1));
return DAG.getNode(ISD::SHL, SDLoc(N), Res.getValueType(), Res, Amt);
}
@@ -628,7 +629,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_
// The input value must be properly sign extended.
SDValue Res = SExtPromotedInteger(N->getOperand(0));
SDValue Amt = N->getOperand(1);
- Amt = Amt.getValueType().isVector() ? ZExtPromotedInteger(Amt) : Amt;
+ if (!TLI.isTypeLegal(Amt.getValueType()))
+ Amt = ZExtPromotedInteger(N->getOperand(1));
return DAG.getNode(ISD::SRA, SDLoc(N), Res.getValueType(), Res, Amt);
}
@@ -636,7 +638,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_
// The input value must be properly zero extended.
SDValue Res = ZExtPromotedInteger(N->getOperand(0));
SDValue Amt = N->getOperand(1);
- Amt = Amt.getValueType().isVector() ? ZExtPromotedInteger(Amt) : Amt;
+ if (!TLI.isTypeLegal(Amt.getValueType()))
+ Amt = ZExtPromotedInteger(N->getOperand(1));
return DAG.getNode(ISD::SRL, SDLoc(N), Res.getValueType(), Res, Amt);
}
More information about the llvm-commits
mailing list