[llvm] [X86][RISCV] Don't emit JumpTableDebugInfo unless triple is OSBinFormatCOFF. (PR #117083)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 16:31:08 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
This makes the override in RISCV and X86 consistent with the base class implementation of expandIndirectJTBranch.
---
Full diff: https://github.com/llvm/llvm-project/pull/117083.diff
2 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+5-3)
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+5-2)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 976b2478b433e5..30de53d43822e8 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -22061,9 +22061,11 @@ SDValue RISCVTargetLowering::expandIndirectJTBranch(const SDLoc &dl,
if (Subtarget.hasStdExtZicfilp()) {
// When Zicfilp enabled, we need to use software guarded branch for jump
// table branch.
- SDValue JTInfo = DAG.getJumpTableDebugInfo(JTI, Value, dl);
- return DAG.getNode(RISCVISD::SW_GUARDED_BRIND, dl, MVT::Other, JTInfo,
- Addr);
+ SDValue Chain = Value;
+ // Jump table debug info is only needed if CodeView is enabled.
+ if (DAG.getTarget().getTargetTriple().isOSBinFormatCOFF())
+ Chain = DAG.getJumpTableDebugInfo(JTI, Chain, dl);
+ return DAG.getNode(RISCVISD::SW_GUARDED_BRIND, dl, MVT::Other, Chain, Addr);
}
return TargetLowering::expandIndirectJTBranch(dl, Value, Addr, JTI, DAG);
}
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index fea66e9582cfba..15e137c3683937 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -59149,8 +59149,11 @@ SDValue X86TargetLowering::expandIndirectJTBranch(const SDLoc &dl,
// notrack prefix to the indirect branch.
// In order to do that we create NT_BRIND SDNode.
// Upon ISEL, the pattern will convert it to jmp with NoTrack prefix.
- SDValue JTInfo = DAG.getJumpTableDebugInfo(JTI, Value, dl);
- return DAG.getNode(X86ISD::NT_BRIND, dl, MVT::Other, JTInfo, Addr);
+ SDValue Chain = Value;
+ // Jump table debug info is only needed if CodeView is enabled.
+ if (DAG.getTarget().getTargetTriple().isOSBinFormatCOFF())
+ Chain = DAG.getJumpTableDebugInfo(JTI, Chain, dl);
+ return DAG.getNode(X86ISD::NT_BRIND, dl, MVT::Other, Chain, Addr);
}
return TargetLowering::expandIndirectJTBranch(dl, Value, Addr, JTI, DAG);
``````````
</details>
https://github.com/llvm/llvm-project/pull/117083
More information about the llvm-commits
mailing list