[llvm] [CHR] Fix crash when marking merged condition unknown (PR #173902)
Peter Waller via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 2 02:49:21 PST 2026
================
@@ -0,0 +1,33 @@
+; RUN: opt < %s -passes='require<profile-summary>,function(chr)' -force-chr -chr-merge-threshold=1 -disable-output
+
+; Regression test for a crash in CHR when setting unknown profdata on the
+; merged condition. IRBuilder::CreateLogicalAnd is implemented as a select and
+; can constant-fold to a non-Instruction value (e.g. `i1 true`). The buggy code
+; assumed it always produced an Instruction and did `cast<Instruction>(V)`,
+; which can segfault in release builds.
+define void @repro_crash() {
+entry:
+ br i1 true, label %then, label %exit, !prof !15
+
+then:
+ br label %exit
+
+exit:
+ ret void
+}
+
+!llvm.module.flags = !{!0}
----------------
peterwaller-arm wrote:
I have tried to delete various unnecessary-looking pieces but did not quickly discover more I can remove and still preserve the crash on the bad version. `llvm-reduce` doesn't remove anything, either. If you have ideas of specific things to remove which preserve the crash, please let me know.
https://github.com/llvm/llvm-project/pull/173902
More information about the llvm-commits
mailing list