[PATCH] D98783: [CUDA][HIP] Remove unused addr space casts

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 17 16:34:46 PDT 2021


tra added a comment.



In D98783#2632244 <https://reviews.llvm.org/D98783#2632244>, @yaxunl wrote:

> In D98783#2632143 <https://reviews.llvm.org/D98783#2632143>, @tra wrote:
>
>> Shouldn't the unused ASCs be eliminated by DCE? We seem to be cleaning up the consequences of a problem that happened somewhere else.
>
> DCE does not eliminate these unused ASCs because normally they should not exist. That's why we do not want them to be kept in the IR emitted by clang.

TBH, these 'invisible' ASCs do bother me. I wonder what else is present in the IR that we can't easily examine with existing tools?
In principle I'm OK with eliminating such dangling ASCs here as a short-term workaround, but I think it's potentially a more general issue which needs a more general solution.

One way to consistently deal with something like that is to codegen something using those ASCs, but which would be considered unused and later DCE'd along with unused ASCs. 
We could use some sort of counterpart for `@llvm.used` only for potentially unused IR we create.
Tying them to such `@llvm_maybe_unused` would avoid the problem.


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

https://reviews.llvm.org/D98783



More information about the cfe-commits mailing list