[PATCH] D141075: [SelectionDAG] Implicitly truncate known bits in SPLAT_VECTOR

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 10:29:56 PST 2023


luke created this revision.
luke added reviewers: reames, hokein, rupprecht.
Herald added subscribers: pmatos, ecnelises, hiraditya.
Herald added a project: All.
luke requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Now that D139525 <https://reviews.llvm.org/D139525> fixes the Hexagon infinite loop, the stopgap can be
removed to provide more information about known bits in SPLAT_VECTOR
whose operands are smaller than the bit width (which is most of the
time)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141075

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2977,17 +2977,11 @@
                             Depth + 1);
   case ISD::SPLAT_VECTOR: {
     SDValue SrcOp = Op.getOperand(0);
-    if (SrcOp.getValueSizeInBits() != BitWidth) {
-      assert(SrcOp.getValueSizeInBits() > BitWidth &&
+      assert(SrcOp.getValueSizeInBits() >= BitWidth &&
              "Expected SPLAT_VECTOR implicit truncation");
-      // FIXME: We should be able to truncate the known bits here to match
-      // the official semantics of SPLAT_VECTOR, but doing so exposes a
-      // Hexagon target bug which results in an infinite loop during
-      // DAGCombine.  (See D137140 for repo).  Once that's fixed, we can
-      // strengthen this.
-      break;
-    }
-    Known = computeKnownBits(SrcOp, Depth + 1);
+    // Implicitly truncate the bits to match the official semantics of
+    // SPLAT_VECTOR.
+    Known = computeKnownBits(SrcOp, Depth + 1).extractBits(BitWidth, 0);
     break;
   }
   case ISD::BUILD_VECTOR:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141075.486624.patch
Type: text/x-patch
Size: 1181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230105/e18bb90c/attachment.bin>


More information about the llvm-commits mailing list