wenlei added a comment.

In D77484#1962445 <https://reviews.llvm.org/D77484#1962445>, @tejohnson wrote:

> We're trying to move towards encoding all of this in the IR. And in fact, I 
> recently implemented a series of patches to make the TLI to be built 
> per-function, and along with some patches from @gchatelet to encode 
> -fno-builtin* as function attributes, we now handle that part of the TLII 
> with IR. See D67923 <https://reviews.llvm.org/D67923> which is the last patch 
> in the series. We should encode the vectlib as function attributes similarly, 
> and just thread that through to the TLI.


Thanks for quick look, @tejohnson. Yeah, making vectlib a function attribute 
would be more consistent with other the way other TLI attributes are handled. 
However, unlike some other attributes, which really need to be per-function, 
conceptually, vectlib setting won't be different from function to function in a 
module. Implementation-wise, even though TLI is now built per-function, there's 
a `BaselineInfoImpl` within each `TargetLibraryInfo`, that's still shared among 
functions, and `VectorDescs` which is populated based on vectlib setting 
belongs to the shared baseline. We could also move `VectorDescs` and its 
population into per-function part of TLI, but I felt that's a bit overkill, 
though I don't have a strong opinion on this. So I followed how other module 
level stuff like `lto-sample-profile` is passed to backend..

Alternatively, we could chose to always run `InjectTLIMappings` in pre-LTO 
pipeline, even if we don't run vectorizer pre-LTO for ThinLTO, so we always 
have per-function attribute `vector-function-abi-variant` populated and 
threaded through to LTO time vectorizer. We will have to make sure the vector 
function list in TLI (based on vectlib setting) has no other use case though.

(More on TLI, while this change (or a variant of this) enables vectorization 
that uses math library for ThinLTO w/ legacy PM, there's separate issue with 
new PM as `InjectTLIMappings` is not scheduled before Vectorization for LTO 
pipeline. I will send a separate patch for that once we settle on a good way to 
handle this one.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77484/new/

https://reviews.llvm.org/D77484



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to