[llvm] [X86] Preserve node flags when combineCMov rebuilds a CMOV (PR #223469)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 02:07:18 PDT 2026
================
@@ -0,0 +1,41 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64 | FileCheck %s
+
+; A select marked !unpredictable must stay a CMOV even when the CMOV folds a
+; load: X86CmovConversion skips CMOVs carrying the unpredictable flag, so the
+; flag must survive the CMOV rewrites in combineCMov.
+
+; The zero is replaced by the compared value (select (x == 0), 0, y -> x).
+define i32 @load_or_zero(i32 %a, ptr %p) {
+; CHECK-LABEL: load_or_zero:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: movl %edi, %eax
+; CHECK-NEXT: testl %edi, %edi
+; CHECK-NEXT: cmovnel (%rsi), %eax
+; CHECK-NEXT: retq
+entry:
----------------
RKSimon wrote:
strip the entry labels - you don't need them if the variables aren't numbered
https://github.com/llvm/llvm-project/pull/223469
More information about the llvm-commits
mailing list