[llvm] [X86] Recognize POP/ADD/SUB modifying rsp in getSPAdjust. (PR #114265)

Daniel Zabawa via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 07:40:28 PST 2025


daniel-zabawa wrote:

@dyung - no worries, and I'm able to reproduce the issue. I've confirmed it's the same issue as the other failure: there is a debug instruction following the ADJCALLSTACKDOWN, and when frame lowering is eliminating said ADJCALLSTACKDOWN, the inserted code is placed after the debug instruction, but the iterator it returns is pointing to the debug instruction.

The prolog/epilog code is written such that it tracks the SP adjustment of ADJCALLSTACKDOWN based on the pseudo, and frame-lowering is expected to insert code to affect that adjustment at the same location. When the fixup code is inserted after one or more debug instructions, prolog/epilog will visit it again. This worked before by simply not recognizing that certain instructions are SP adjustments.

As I mentioned before, I have not been able to reproduce whatever issue was fixed by the frame-lowering change to insert frame pseudo replacement code after debug instructions. If anything, it may have been due to some interaction with other frame-lowering code that is trying to parse the frame setup to do some simplification, but I cannot tell what that code is.

Ideally I'd like to avoid the situation where pseudo replacement code is reordered with debug instructions, but without knowing the root issue at the time it was changed, it will require thorough testing.

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


More information about the llvm-commits mailing list