[llvm] [AArch64] Fix tryMergeAdjacentSTG function in PrologEpilog pass (PR #68873)

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 04:00:03 PST 2023


================
@@ -3761,7 +3761,26 @@ MachineBasicBlock::iterator tryMergeAdjacentSTG(MachineBasicBlock::iterator II,
 
   // New code will be inserted after the last tagging instruction we've found.
   MachineBasicBlock::iterator InsertI = Instrs.back().MI;
+
+  // All the gathered stack tag instructions are merged and placed after
+  // last tag store in the list. The check should be made if the nzcv
+  // flag is live at the point where we are trying to insert. Otherwise
+  // the nzcv flag might get clobbered if any stg loops are present.
+
+  // FIXME : This approach of bailing out from merge is also conservative
+  // in some ways like even if stg loops are not present after merge in
+  // the insert list, this liveness check is done (which is not needed).
+  LivePhysRegs LR(*(MBB->getParent()->getSubtarget().getRegisterInfo()));
----------------
kbeyls wrote:

Maybe name this variable "LiveRegs" rather than "LR". It seems that is by far the most common variable named used across the backends for a variable of type LivePhysRegs.

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


More information about the llvm-commits mailing list