Skip to content

Commit a85beb8

Browse files
committed
[SelectionDAG] Propagate Disjoint flag.
Signed-off-by: feng.feng <[email protected]>
1 parent d08e118 commit a85beb8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9530,7 +9530,8 @@ static SDValue combineShiftOfShiftedLogic(SDNode *Shift, SelectionDAG &DAG) {
95309530
SDValue ShiftSumC = DAG.getConstant(*C0Val + C1Val, DL, ShiftAmtVT);
95319531
SDValue NewShift1 = DAG.getNode(ShiftOpcode, DL, VT, X, ShiftSumC);
95329532
SDValue NewShift2 = DAG.getNode(ShiftOpcode, DL, VT, Y, C1);
9533-
return DAG.getNode(LogicOpcode, DL, VT, NewShift1, NewShift2);
9533+
return DAG.getNode(LogicOpcode, DL, VT, NewShift1, NewShift2,
9534+
LogicOp->getFlags());
95349535
}
95359536

95369537
/// Handle transforms common to the three shifts, when the shift amount is a

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@ bool TargetLowering::ShrinkDemandedConstant(SDValue Op,
544544
if (!C.isSubsetOf(DemandedBits)) {
545545
EVT VT = Op.getValueType();
546546
SDValue NewC = TLO.DAG.getConstant(DemandedBits & C, DL, VT);
547-
SDValue NewOp = TLO.DAG.getNode(Opcode, DL, VT, Op.getOperand(0), NewC);
547+
SDValue NewOp = TLO.DAG.getNode(Opcode, DL, VT, Op.getOperand(0), NewC,
548+
Op->getFlags());
548549
return TLO.CombineTo(Op, NewOp);
549550
}
550551

llvm/test/CodeGen/X86/propagate-disjoint-in-shl-or.ll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ define i32 @add_shl_or_disjoint(i32 %x) {
55
; CHECK-LABEL: add_shl_or_disjoint:
66
; CHECK: # %bb.0:
77
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
8-
; CHECK-NEXT: leal (,%rdi,4), %eax
9-
; CHECK-NEXT: orl $-1069531068, %eax # imm = 0xC0404044
10-
; CHECK-NEXT: addl $1234567890, %eax # imm = 0x499602D2
8+
; CHECK-NEXT: leal 165036822(,%rdi,4), %eax
119
; CHECK-NEXT: retq
1210
%or = or disjoint i32 %x, 4027584529
1311
%shl = shl i32 %or, 2

0 commit comments

Comments
 (0)