[llvm] [InstCombine] Don't folder select to or if value argument is user of invalid addrspacecast inst (PR #144686)
Wenju He via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 20:03:18 PDT 2025
wenju-he wrote:
> If an invalid addrspacecast can produce poison, then this must be specified in
>
> https://github.com/llvm/llvm-project/blob/34a48941498d95ec2682f7adaeb6115b7b4d70ba/llvm/lib/Analysis/ValueTracking.cpp#L7352
This PR uses isValidAddrSpaceCast query from TTI which is available in InstCombine. But TTI isn't available in above canCreateUndefOrPoison function.
If we unconditionally return true for addrspacecast in canCreateUndefOrPoison, there is regression in following test probably because canCreateUndefOrPoison returning true for valid addrspacecast is preventing the optimization: https://github.com/llvm/llvm-project/blob/5875fafdc547889fb089c943a881a9ab6d8a23c0/llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll#L4-L19
> LangRef should also be adjusted in https://llvm.org/docs/LangRef.html#addrspacecast-to-instruction to specify that addrspacecast can introduce poison.
done in ffff2c3624239c1290e71abcce44f3317aab597a, please review
https://github.com/llvm/llvm-project/pull/144686
More information about the llvm-commits
mailing list