Skip to content

Commit 9a21e38

Browse files
committed
[DAG] Apply Disjoint flag.
or disjoint (or disjoint (x, c0), c1) --> or disjont x, or (c0, c1) Alive2: https://alive2.llvm.org/ce/z/3wPth5 Signed-off-by: feng.feng <[email protected]>
1 parent f2d500c commit 9a21e38

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,11 @@ SDValue DAGCombiner::reassociateOpsCommutative(unsigned Opc, const SDLoc &DL,
12201220

12211221
if (DAG.isConstantIntBuildVectorOrConstantInt(N1)) {
12221222
// Reassociate: (op (op x, c1), c2) -> (op x, (op c1, c2))
1223-
if (SDValue OpNode = DAG.FoldConstantArithmetic(Opc, DL, VT, {N01, N1}))
1223+
if (SDValue OpNode = DAG.FoldConstantArithmetic(Opc, DL, VT, {N01, N1})) {
1224+
NewFlags.setDisjoint(Flags.hasDisjoint() &&
1225+
N0->getFlags().hasDisjoint());
12241226
return DAG.getNode(Opc, DL, VT, N00, OpNode, NewFlags);
1227+
}
12251228
return SDValue();
12261229
}
12271230
if (TLI.isReassocProfitable(DAG, N0, N1)) {

0 commit comments

Comments
 (0)