summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-05-28 21:29:59 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-05-28 21:29:59 +0000
commit22d2b027062151ceb208671ebdbb5bda7b6401e3 (patch)
tree74f25ecaea5278445a56f3216cbefc1f1e000a11 /llvm/lib/CodeGen
parentbfcad2f1813e5da355ceece8ebbb75f282f76b34 (diff)
downloadbcm5719-llvm-22d2b027062151ceb208671ebdbb5bda7b6401e3.tar.gz
bcm5719-llvm-22d2b027062151ceb208671ebdbb5bda7b6401e3.zip
[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. llvm-svn: 238503
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index eeaebf780cc..278929dff22 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -604,7 +604,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
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_SRA(SDNode *N) {
// 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_SRL(SDNode *N) {
// 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);
}
OpenPOWER on IntegriCloud