[llvm] [RISCV] Emit lpad for function with returns-twice attribute (PR #170520)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 10:02:03 PST 2025


================
@@ -100,5 +110,21 @@ bool RISCVIndirectBranchTracking::runOnMachineFunction(MachineFunction &MF) {
     }
   }
 
+  // Check for calls to functions with ReturnsTwice attribute and insert
+  // LPAD after such calls
+  for (MachineBasicBlock &MBB : MF) {
+    for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I) {
+      if (I->isCall() && I->getNumOperands() > 0) {
+        if (IsCallReturnTwice(I->getOperand(0))) {
----------------
topperc wrote:

Combine with previous `if`

https://github.com/llvm/llvm-project/pull/170520


More information about the llvm-commits mailing list