[llvm] [AArch64] Normalize (bool CC 1) to (bool NewCC 0) in LowerBR_CC (PR #189380)

Valeriy Savchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 05:07:43 PDT 2026


================

----------------
SavchenkoValeriy wrote:

I originally didn't include this check and after testing on it on a larger corpus noticed this class of codegen regressions.
It looks like this.
```diff
@@ -1594,13 +1594,15 @@ Lloh217:
 	ldr	x8, [x8, _cbp at GOTPAGEOFF]
 Lloh218:
 	ldr	w9, [x8]
+	cmp	w9, #0
 Lloh219:
 	adrp	x8, _best_mode at GOTPAGE
 Lloh220:
 	ldr	x8, [x8, _best_mode at GOTPAGEOFF]
 	ldrh	w8, [x8]
-	cmp	w8, #10
-	ccmp	w9, #0, #0, ne
+	ccmp	w8, #10, #4, eq
+	cset	w10, eq
+	cmp	w10, #0
 	ccmp	w8, #14, #4, ne
 	b.ne	LBB0_129
 ; %bb.127:                              ; %if.else615
```

My minimized example didn't actually capture this type of regression, so let me first add this test and then re-structure my commits to make the usefulness of this check more clear.

It is quite possible that there is a simpler solution and I just don't see it

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


More information about the llvm-commits mailing list