[llvm] r351005 - Use getShiftAmountTy for shift amounts.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 12 04:00:43 PST 2019


Author: rksimon
Date: Sat Jan 12 04:00:43 2019
New Revision: 351005

URL: http://llvm.org/viewvc/llvm-project?rev=351005&view=rev
Log:
Use getShiftAmountTy for shift amounts.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=351005&r1=351004&r2=351005&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sat Jan 12 04:00:43 2019
@@ -4719,6 +4719,7 @@ bool TargetLowering::expandABS(SDNode *N
                                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 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;




More information about the llvm-commits mailing list