[clang] [llvm] [Arm] Regenerate tests (NFC) (PR #121801)
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 10:01:36 PST 2025
momchil-velikov wrote:
> > This patch adds instcombine to some tests that were passing
> Can the instcombines be replaced with something simpler like dce or maybe instsimplify? It might be OK with just mem2reg.
Unfortunately just `mem2reg` does not cut it. The original issue it that Clang generates very different code for C-style
cast and `__builtin_bit_cast`, e.g. for (https://gcc.godbolt.org/z/7rKqhTY5W)
```
typedef __attribute__((neon_vector_type(4))) unsigned uint32x4_t;
typedef __attribute__((neon_vector_type(4))) float float32x4_t;
uint32x4_t f(float32x4_t v) {
return __builtin_bit_cast(uint32x4_t ,v);
}
uint32x4_t g(float32x4_t v) {
return (uint32x4_t) v;
}
```
and the differences persist after `mem2reg` :
```
define dso_local <4 x i32> @f(<4 x float> noundef %v) #0 {
entry:
%v.addr = alloca <4 x float>, align 16
store <4 x float> %v, ptr %v.addr, align 16
%0 = load <4 x i32>, ptr %v.addr, align 16
ret <4 x i32> %0
}
define dso_local <4 x i32> @g(<4 x float> noundef %v) #0 {
entry:
%0 = bitcast <4 x float> %v to <4 x i32>
ret <4 x i32> %0
}
```
which makes the test updates after https://github.com/llvm/llvm-project/pull/121802 very hard to inspect.
I can try with `sroa` instead of `instcombine` (works on this example above at least)
https://github.com/llvm/llvm-project/pull/121801
More information about the llvm-commits
mailing list