[clang] [Clang] Initialize bypassed variables w/ trivial-auto-var-init (PR #181937)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 14:52:01 PDT 2026


================
@@ -77,35 +77,31 @@ void test_block_captures_self_after_init() {
   });
 }
 
-// This type of code is currently not handled by zero / pattern initialization.
-// The test will break when that is fixed.
+// Bypassed variables are initialized at the goto source (before the branch).
 // UNINIT-LABEL:  test_goto_unreachable_value(
 // ZERO-LABEL:    test_goto_unreachable_value(
-// ZERO-NOT: store {{.*}}%oops
+// ZERO: %oops = alloca i32, align 4
+// ZERO: store i32 0, ptr %oops, align 4, !annotation [[AUTO_INIT:!.+]]
+// ZERO: br label %jump
 // PATTERN-LABEL: test_goto_unreachable_value(
-// PATTERN-NOT: store {{.*}}%oops
+// PATTERN: %oops = alloca i32, align 4
+// PATTERN: store i32 -1431655766, ptr %oops, align 4, !annotation [[AUTO_INIT:!.+]]
+// PATTERN: br label %jump
 void test_goto_unreachable_value() {
   goto jump;
   int oops;
  jump:
   used(oops);
 }
 
-// This type of code is currently not handled by zero / pattern initialization.
-// The test will break when that is fixed.
+// Bypassed variables are initialized at the jump target.
----------------
nickdesaulniers wrote:

Is this outdated?
```suggestion
// Bypassed variables are initialized at the goto source (before the branch).
```

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


More information about the cfe-commits mailing list