[llvm] [X86][Inline] Skip inline asm in inlining target feature check (PR #83820)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 16:37:44 PST 2024


phoebewang wrote:

> @phoebewang I just double checked to confirm that your patch does not address this issue. Here's a very simple example:
> 
> ```
> target triple = "x86_64-unknown-linux-gnu"
> 
> @g = external global i8
>  
> define void @test1(ptr %p) nounwind "target-features"="+avx" {
>   call void @test2(ptr %p) 
>   ret void
> } 
>  
> define internal void @test2(ptr %p) {
>   call void @test3(ptr %p)
>   ret void
> } 
>  
> define internal void @test3(ptr %p) nounwind noinline {
>   %v = load <4 x i64>, ptr %p
>   store <4 x i64> %v, ptr @g
>   ret void 
> }  
> ```
> 
> Note that this does not pass any vectors by value.
> 
> Now comment out the check in areInlineCompatible and run `build/bin/opt -S -passes=argpromotion,inline | build/bin/llc` and you will get the argument passed in ymm0 in test1 and accepted in xmm0 and xmm1 in test3.

I didn't get ymm0 in test1:
https://godbolt.org/z/4jY9vqeMa
https://godbolt.org/z/h76jW5a9W

The argument is passed by pointer between test1 and test2, because in `areTypesABICompatible`, we have made sure of caller and callee have identical features. https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h#L844

The only hole was `min-legal-vector-width` which had been fixed.

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


More information about the llvm-commits mailing list