[PATCH] D77767: Prevent stack coloring functions whith setjmp / longjmp

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 15:12:38 PDT 2020


efriedma added a comment.

> From what I see in the code it seems that none of the register allocators know anything about setjmp

StackSlotColoring checks MF.exposesReturnsTwice(); that's related to register allocation.  But yes, the allocators themselves don't have any checks.

Going into the register allocator, distinct SSA values should be in distinct registers.  We can take advantage of this to preserve our invariants.  If each of those distinct SSA values gets its own spill slot, that should be enough to avoid this class of issue: after the setjmp, the value would always be the same value we computed before the setjmp.  This is basically the point of the check in StackSlotColoring.

But I guess the check there isn't enough in some cases.  Maybe the problem is register coalescing?

(This is basically the same conclusion as https://lists.llvm.org/pipermail/llvm-dev/2011-October/043734.html .)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77767/new/

https://reviews.llvm.org/D77767





More information about the llvm-commits mailing list