Skip to content

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Oct 12, 2025

No description provided.

@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Oct 12, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 12, 2025

@llvm/pr-subscribers-llvm-selectiondag

Author: AZero13 (AZero13)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/163095.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+2-1)
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index b1accdd066dfd..f12b73f82e402 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4749,7 +4749,8 @@ template <class MatchContextClass> SDValue DAGCombiner::visitMUL(SDNode *N) {
       SDValue Trunc = DAG.getZExtOrTrunc(LogBase2, DL, ShiftVT);
       SDNodeFlags Flags;
       Flags.setNoUnsignedWrap(N->getFlags().hasNoUnsignedWrap());
-      // TODO: Preserve setNoSignedWrap if LogBase2 isn't BitWidth - 1.
+      if (LogBase2.getZExtValue() != BitWidth - 1)
+        Flags.setNoSignedWrap(N->getFlags().hasNoSignedWrap());
       return Matcher.getNode(ISD::SHL, DL, VT, N0, Trunc, Flags);
     }
   }

@AZero13 AZero13 changed the title Preserve setNoSignedWrap if LogBase2 isn't BitWidth - 1. Preserve setNoSignedWrap if LogBase2 isn't BitWidth - 1 Oct 12, 2025
@AZero13 AZero13 closed this Oct 12, 2025
@AZero13 AZero13 deleted the topological branch October 12, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:SelectionDAG SelectionDAGISel as well

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants