[llvm] [WebAssembly] Fix missed optimization in 50142 (PR #144741)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 14:54:59 PDT 2025


================
@@ -0,0 +1,22 @@
+; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s
+
+target triple = "wasm64"
+
+;CHECK:all_true:
+;CHECK-NEXT:        .functype       all_true (i64) -> (i32)
+;CHECK-NEXT: v128.load       $push0=, 0($0):p2align=0
+;CHECK-NEXT:        i8x16.all_true  $push1=, $pop0
+;CHECK-NEXT:        return  $pop1
+;CHECK-NEXT:        end_function
+; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
+define hidden range(i32 0, 2) i32 @all_true(ptr noundef readonly captures(none) %a) local_unnamed_addr #0 {
+entry:
+  %0 = load <16 x i8>, ptr %a, align 1
+  %.fr = freeze <16 x i8> %0
+  %1 = icmp eq <16 x i8> %.fr, zeroinitializer
----------------
lukel97 wrote:

The load and freeze shouldn't be relative for this test so you can probably just pass the vector in:

```suggestion
define i32 @all_true(<16 x i8>) {
  %1 = icmp eq <16 x i8> %v, zeroinitializer
```

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


More information about the llvm-commits mailing list