]> granicus.if.org Git - llvm/commitdiff
Use getShiftAmountTy for shift amounts.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 12 Jan 2019 12:00:43 +0000 (12:00 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 12 Jan 2019 12:00:43 +0000 (12:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351005 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 1d8615ccce96fe0aabc7f9287a53689f48e72215..0175bcd7339c4ec4e14f210b5d7637a5441957ff 100644 (file)
@@ -4719,6 +4719,7 @@ bool TargetLowering::expandABS(SDNode *N, SDValue &Result,
                                SelectionDAG &DAG) const {
   SDLoc dl(N);
   EVT VT = N->getValueType(0);
+  EVT ShVT = getShiftAmountTy(VT, DAG.getDataLayout());
   SDValue Op = N->getOperand(0);
 
   // Only expand vector types if we have the appropriate vector operations.
@@ -4729,7 +4730,7 @@ bool TargetLowering::expandABS(SDNode *N, SDValue &Result,
 
   SDValue Shift =
       DAG.getNode(ISD::SRA, dl, VT, Op,
-                  DAG.getConstant(VT.getScalarSizeInBits() - 1, dl, VT));
+                  DAG.getConstant(VT.getScalarSizeInBits() - 1, dl, ShVT));
   SDValue Add = DAG.getNode(ISD::ADD, dl, VT, Op, Shift);
   Result = DAG.getNode(ISD::XOR, dl, VT, Add, Shift);
   return true;