[llvm] [Peephole] Fix "Use not jointly dominated by defs." crash (PR #202216)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 05:19:17 PDT 2026


================
@@ -0,0 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-- -verify-machineinstrs | FileCheck %s
+
+; Make sure this does not crash with "Use not jointly dominated by defs."
+; The load-folded compare was dropped from LocalMIs via a stale pointer and
+; rewritten to use a not-yet-defined extension result.
+
+ at g = global i8 0
+
+define void @pr199237() {
+; CHECK-LABEL: pr199237:
+; CHECK:       # %bb.0: # %BB
+; CHECK-NEXT:    movq g at GOTPCREL(%rip), %rax
+; CHECK-NEXT:    movzbl (%rax), %ecx
+; CHECK-NEXT:    cmpb 0, %cl
+; CHECK-NEXT:    setg (%rax)
+; CHECK-NEXT:    setae 0
+; CHECK-NEXT:    movsbq %cl, %rax
+; CHECK-NEXT:    .p2align 4
+; CHECK-NEXT:  .LBB0_1: # %BB2
+; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
+; CHECK-NEXT:    movq %rax, 0
+; CHECK-NEXT:    jmp .LBB0_1
+BB:
+  %v = load i8, ptr @g, align 1
+  %w = load i8, ptr null, align 1
----------------
arsenm wrote:

Can you avoid the UB in the test?

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


More information about the llvm-commits mailing list