[llvm] [DAG] Improve known bits of Zext/Sext loads with range metadata (PR #80829)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 11 01:34:43 PST 2024


================
@@ -21,9 +21,7 @@ define noundef i1 @logger(i32 noundef %logLevel, ptr %ea, ptr %pll) {
 ; CHECK-NEXT:    ret
 ; CHECK-NEXT:  .LBB1_2: // %land.rhs
 ; CHECK-NEXT:    ldr x8, [x1]
-; CHECK-NEXT:    ldrb w8, [x8]
-; CHECK-NEXT:    cmp w8, #0
-; CHECK-NEXT:    cset w0, ne
+; CHECK-NEXT:    ldrb w0, [x8]
----------------
davemgreen wrote:

Yeah I need to add some better tests. Whilst this seems to come up a fair amount during C++ code (bools often have range metadata applied), it can be difficult to test is simple cases as the `sext(load !range)` is often already optimized before it creates the `load sext !range`. It might require C++ testing.

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


More information about the llvm-commits mailing list