Skip to content

Commit 13d8d4e

Browse files
Prefer NUW flags as per https://alive2.llvm.org/ce/z/_V5s8p
1 parent d921291 commit 13d8d4e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10620,8 +10620,12 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
1062010620

1062110621
// fold (shl (X * vscale(VS0)), C1) -> (X * vscale(VS0 << C1))
1062210622
if (N1C && sd_match(N0, m_Mul(m_Value(X), m_VScale(m_ConstInt(VS0))))) {
10623+
SDNodeFlags Flags;
10624+
Flags.setNoUnsignedWrap(N->getFlags().hasNoUnsignedWrap() &&
10625+
N0->getFlags().hasNoUnsignedWrap());
10626+
1062310627
SDValue VScale = DAG.getVScale(DL, VT, VS0 << N1C->getAPIntValue());
10624-
return DAG.getNode(ISD::MUL, DL, VT, X, VScale);
10628+
return DAG.getNode(ISD::MUL, DL, VT, X, VScale, Flags);
1062510629
}
1062610630

1062710631
// Fold (shl step_vector(C0), C1) to (step_vector(C0 << C1)).

0 commit comments

Comments
 (0)