[llvm] [CodeGen] Don't merge stack slots accessed with volatile after setjmp (returns twice) calls (PR #181370)

Mikołaj Piróg via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 22 14:20:31 PST 2026


mikolaj-pirog wrote:

> So the problem here is just with the first-use heuristic, not stack coloring in general right?

To me the first-use heuristic is a part of stack-coloring, but yes, only that was wrong.

> I think it would be fine to just fully disable first-use for a function that exposesReturnsTwice. I don't think there is a need to handle this exotic case in more detail than that.

I didn't want to go with this route because it's too conservative. Granted, it's simpler and the edge-case is exotic in regular code, but given that this implementation isn't too involved and there isn't a performance hit in code without setjmps, I would prefer to go with this route. My motivation is that the users that use setjmps heavily would suffer  bigger stack usage than optimum. 

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


More information about the llvm-commits mailing list