Skip to content

Commit cdd1e27

Browse files
authored
[X86][RISCV] Don't emit JumpTableDebugInfo unless triple is OSBinFormatCOFF. (#117083)
This makes the override in RISCV and X86 consistent with the base class implementation of expandIndirectJTBranch.
1 parent 9e8200c commit cdd1e27

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22061,9 +22061,11 @@ SDValue RISCVTargetLowering::expandIndirectJTBranch(const SDLoc &dl,
2206122061
if (Subtarget.hasStdExtZicfilp()) {
2206222062
// When Zicfilp enabled, we need to use software guarded branch for jump
2206322063
// table branch.
22064-
SDValue JTInfo = DAG.getJumpTableDebugInfo(JTI, Value, dl);
22065-
return DAG.getNode(RISCVISD::SW_GUARDED_BRIND, dl, MVT::Other, JTInfo,
22066-
Addr);
22064+
SDValue Chain = Value;
22065+
// Jump table debug info is only needed if CodeView is enabled.
22066+
if (DAG.getTarget().getTargetTriple().isOSBinFormatCOFF())
22067+
Chain = DAG.getJumpTableDebugInfo(JTI, Chain, dl);
22068+
return DAG.getNode(RISCVISD::SW_GUARDED_BRIND, dl, MVT::Other, Chain, Addr);
2206722069
}
2206822070
return TargetLowering::expandIndirectJTBranch(dl, Value, Addr, JTI, DAG);
2206922071
}

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59159,8 +59159,11 @@ SDValue X86TargetLowering::expandIndirectJTBranch(const SDLoc &dl,
5915959159
// notrack prefix to the indirect branch.
5916059160
// In order to do that we create NT_BRIND SDNode.
5916159161
// Upon ISEL, the pattern will convert it to jmp with NoTrack prefix.
59162-
SDValue JTInfo = DAG.getJumpTableDebugInfo(JTI, Value, dl);
59163-
return DAG.getNode(X86ISD::NT_BRIND, dl, MVT::Other, JTInfo, Addr);
59162+
SDValue Chain = Value;
59163+
// Jump table debug info is only needed if CodeView is enabled.
59164+
if (DAG.getTarget().getTargetTriple().isOSBinFormatCOFF())
59165+
Chain = DAG.getJumpTableDebugInfo(JTI, Chain, dl);
59166+
return DAG.getNode(X86ISD::NT_BRIND, dl, MVT::Other, Chain, Addr);
5916459167
}
5916559168

5916659169
return TargetLowering::expandIndirectJTBranch(dl, Value, Addr, JTI, DAG);

0 commit comments

Comments
 (0)