[PATCH] D56406: Check for single use in cvt_f32_ubyte combine instead of ShrinkDemandedConstant

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 13:12:52 PST 2019


rampitec created this revision.
rampitec added reviewers: arsenm, b-sumner.
Herald added subscribers: kristof.beyls, javed.absar, nhaehnle, wdng, jvesely.

This moves check for single use from general ShrinkDemandedConstant
to the BE because of the AArch64 regression after D56289 <https://reviews.llvm.org/D56289>/rL350475 <https://reviews.llvm.org/rL350475>.

After several hours of experiments I did not come up with a testcase
failing on any other targets if check is not performed.


https://reviews.llvm.org/D56406

Files:
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  lib/Target/AMDGPU/SIISelLowering.cpp


Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -8586,7 +8586,7 @@
   TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
                                         !DCI.isBeforeLegalizeOps());
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
-  if (TLI.ShrinkDemandedConstant(Src, Demanded, TLO) ||
+  if ((Src.hasOneUse() && TLI.ShrinkDemandedConstant(Src, Demanded, TLO)) ||
       TLI.SimplifyDemandedBits(Src, Demanded, Known, TLO)) {
     DCI.CommitTargetLoweringOpt(TLO);
   }
Index: lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -350,9 +350,6 @@
   SDLoc DL(Op);
   unsigned Opcode = Op.getOpcode();
 
-  if (!Op.hasOneUse())
-    return false;
-
   // Do target-specific constant optimization.
   if (targetShrinkDemandedConstant(Op, Demanded, TLO))
     return TLO.New.getNode();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56406.180551.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190107/0ea8b606/attachment.bin>


More information about the llvm-commits mailing list