[llvm] r367768 - [DAGCombiner] Prevent the combine added in r367710 from creating illegal types after type legalization.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 3 16:09:13 PDT 2019


Author: ctopper
Date: Sat Aug  3 16:09:13 2019
New Revision: 367768

URL: http://llvm.org/viewvc/llvm-project?rev=367768&view=rev
Log:
[DAGCombiner] Prevent the combine added in r367710 from creating illegal types after type legalization.

This is further fix for PR42880.

Sanjay already disabled the X86 TLI hook for non-simple types,
but we should really call isTypeLegal here if we're after type
legalization.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=367768&r1=367767&r2=367768&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Aug  3 16:09:13 2019
@@ -7631,7 +7631,7 @@ SDValue DAGCombiner::visitSRA(SDNode *N)
       EVT TruncVT = EVT::getIntegerVT(Ctx, OpSizeInBits - ShiftAmt);
       if (VT.isVector())
         TruncVT = EVT::getVectorVT(Ctx, TruncVT, VT.getVectorNumElements());
-      if (TLI.isTruncateFree(VT, TruncVT)) {
+      if (isTypeLegal(TruncVT) && TLI.isTruncateFree(VT, TruncVT)) {
         SDLoc DL(N);
         SDValue Trunc = DAG.getZExtOrTrunc(Shl.getOperand(0), DL, TruncVT);
         SDValue ShiftC = DAG.getConstant(AddC->getAPIntValue().lshr(ShiftAmt).




More information about the llvm-commits mailing list