[llvm] [StackColoring] Add test for stack-coloring and setjmp (PR #199959)
Mikołaj Piróg via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 06:58:36 PDT 2026
================
@@ -0,0 +1,76 @@
+; RUN: llc -mtriple=x86_64-linux -no-stack-coloring=false -debug-only=stack-coloring < %s -o /dev/null 2>&1 | FileCheck %s
+; REQUIRES: asserts
+
+; Test that volatile stack slots accessed after setjmp are not merged.
+; Volatile variables must retain their values across longjmp, so their
+; stack slots cannot be reused even if their lifetimes don't overlap.
+
+declare i32 @setjmp(ptr) returns_twice
+declare void @baz(ptr)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
+declare dso_local void @stash(ptr noundef, ptr noundef) local_unnamed_addr
+declare dso_local void @use(ptr noundef) local_unnamed_addr
+
+; CHECK-LABEL: setjmp_test
+; CHECK: Conservative slots : { 1 1 }
----------------
mikolaj-pirog wrote:
Conservative slots tells us for which slots the usage heuristic is turned off -- for those the lifetime is designated by the lifetime markers
https://github.com/llvm/llvm-project/pull/199959
More information about the llvm-commits
mailing list