Skip to content

Commit 27a0706

Browse files
toppercDebadri Basak
authored andcommitted
[SelectionDAG] Use GetPromotedInteger when promoting integer operands of PATCHPOINT/STACKMAP. (llvm#165926)
This is consistent with other promotion, but causes negative constants to be sign extended instead of zero extended in some cases. I guess getNode and type legalizer are inconsistent about what ANY_EXTEND of a constant does.
1 parent a7f1ed0 commit 27a0706

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,18 +2871,14 @@ SDValue DAGTypeLegalizer::PromoteIntOp_SET_ROUNDING(SDNode *N) {
28712871
SDValue DAGTypeLegalizer::PromoteIntOp_STACKMAP(SDNode *N, unsigned OpNo) {
28722872
assert(OpNo > 1); // Because the first two arguments are guaranteed legal.
28732873
SmallVector<SDValue> NewOps(N->ops());
2874-
SDValue Operand = N->getOperand(OpNo);
2875-
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), Operand.getValueType());
2876-
NewOps[OpNo] = DAG.getNode(ISD::ANY_EXTEND, SDLoc(N), NVT, Operand);
2874+
NewOps[OpNo] = GetPromotedInteger(NewOps[OpNo]);
28772875
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
28782876
}
28792877

28802878
SDValue DAGTypeLegalizer::PromoteIntOp_PATCHPOINT(SDNode *N, unsigned OpNo) {
28812879
assert(OpNo >= 7);
28822880
SmallVector<SDValue> NewOps(N->ops());
2883-
SDValue Operand = N->getOperand(OpNo);
2884-
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), Operand.getValueType());
2885-
NewOps[OpNo] = DAG.getNode(ISD::ANY_EXTEND, SDLoc(N), NVT, Operand);
2881+
NewOps[OpNo] = GetPromotedInteger(NewOps[OpNo]);
28862882
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
28872883
}
28882884

llvm/test/CodeGen/AArch64/stackmap.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
; CHECK-NEXT: .hword 8
8282
; CHECK-NEXT: .hword 0
8383
; CHECK-NEXT: .hword 0
84-
; CHECK-NEXT: .word 65535
84+
; CHECK-NEXT: .word -1
8585
; SmallConstant
8686
; CHECK-NEXT: .byte 4
8787
; CHECK-NEXT: .byte 0
8888
; CHECK-NEXT: .hword 8
8989
; CHECK-NEXT: .hword 0
9090
; CHECK-NEXT: .hword 0
91-
; CHECK-NEXT: .word 65535
91+
; CHECK-NEXT: .word -1
9292
; SmallConstant
9393
; CHECK-NEXT: .byte 4
9494
; CHECK-NEXT: .byte 0

llvm/test/CodeGen/SystemZ/stackmap.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@
8484
; CHECK-NEXT: .short 8
8585
; CHECK-NEXT: .short 0
8686
; CHECK-NEXT: .short 0
87-
; CHECK-NEXT: .long 65535
87+
; CHECK-NEXT: .long -1
8888
; SmallConstant
8989
; CHECK-NEXT: .byte 4
9090
; CHECK-NEXT: .byte 0
9191
; CHECK-NEXT: .short 8
9292
; CHECK-NEXT: .short 0
9393
; CHECK-NEXT: .short 0
94-
; CHECK-NEXT: .long 65535
94+
; CHECK-NEXT: .long -1
9595
; SmallConstant
9696
; CHECK-NEXT: .byte 4
9797
; CHECK-NEXT: .byte 0

0 commit comments

Comments
 (0)