[llvm] [X86][RISCV] Don't emit JumpTableDebugInfo unless triple is OSBinFormatCOFF. (PR #117083)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 16:30:33 PST 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/117083
This makes the override in RISCV and X86 consistent with the base class implementation of expandIndirectJTBranch.
>From 7a7eacf0a98eafc022cd3f56d15c9ecdda8c4b61 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 20 Nov 2024 16:27:52 -0800
Subject: [PATCH] [X86][RISCV] Don't emit JumpTableDebugInfo unless triple is
OSBinFormatCOFF.
This makes the override in RISCV and X86 consistent with the base class
implementation of expandIndirectJTBranch.
---
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 8 +++++---
llvm/lib/Target/X86/X86ISelLowering.cpp | 7 +++++--
2 files changed, 10 insertions(+), 5 deletions(-)
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);
More information about the llvm-commits
mailing list