[llvm] [SimplifyCFG][PGO] Add missing overflow check to ConstantFoldTerminator (PR #178964)

Mitchel Dickerson via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 17:52:13 PST 2026


================
@@ -0,0 +1,22 @@
+; Ensure branch weight does not overflow when folding block 3 into block 0:
+; RUN: opt < %s -passes=simplifycfg -S | FileCheck %s
+
+define void @foo(ptr %Overflow) {
+  %1 = extractvalue { i32, i1 } zeroinitializer, 0
+  %2 = icmp eq i32 %1, 0
+  br i1 %2, label %6, label %3
----------------
mauve-stinger wrote:

Sounds good. I will add the second test and document in the `switch` test its relationship to the current test.

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


More information about the llvm-commits mailing list