[PATCH] D122634: [RISCV] Do not outline CFI instructions when they are needed in EH
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 22:18:10 PDT 2022
pcwang-thead created this revision.
pcwang-thead added reviewers: lewis-revill, asb, jrtc27, luismarques, craig.topper.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added subscribers: llvm-commits, eopXD, MaskRay.
Herald added a project: LLVM.
We saw a failure caused by unwinding with incomplete CFIs, so we
can't outline CFI instructions when they are needed in EH.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122634
Files:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1246,7 +1246,12 @@
if (MI.isPosition()) {
// We can manually strip out CFI instructions later.
if (MI.isCFIInstruction())
- return outliner::InstrType::Invisible;
+ // If current function has exception handling code, we can't outline &
+ // strip these CFI instructions since it may break .eh_frame section
+ // needed in unwinding.
+ return MI.getMF()->getFunction().needsUnwindTableEntry()
+ ? outliner::InstrType::Illegal
+ : outliner::InstrType::Invisible;
return outliner::InstrType::Illegal;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122634.418787.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220329/5847954a/attachment.bin>
More information about the llvm-commits
mailing list