[PATCH] D101538: [GlobalISel][IRTranslator] Make translate() methods virtual.

Aleksandr Bezzubikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 11:35:43 PDT 2021


zuban32 added a comment.

In D101538#2764529 <https://reviews.llvm.org/D101538#2764529>, @arsenm wrote:

> In D101538#2751818 <https://reviews.llvm.org/D101538#2751818>, @aemerson wrote:
>
>> In D101538#2750853 <https://reviews.llvm.org/D101538#2750853>, @zuban32 wrote:
>>
>>> In D101538#2745606 <https://reviews.llvm.org/D101538#2745606>, @aemerson wrote:
>>>
>>>> Is this really necessary? Our preference is to use custom combines/lowering passes, or custom legalization, to do this.
>>>
>>> Well, our usecase might not be that canonical, let me briefly explain. For example, translating a bitcast - default IRTranslator implementation turns it into a COPY when LLTs of src and dst are the same. In our target (SPIR-V) LLTs do not matter that much, the typeinfo is represented with some pseudo instructions, so we run into this situation quite often. And losing a bitcast in the translator doesn't work for us as it'd obviously be quite difficult to recover it.
>
> Won't this problem go away when we introduce FP LLTs?

I wouldn't be so sure about that. One particular usecase I need this for is a bitcast between pointer types:

  %1 = bitcast i8* %0 to %struct.ST*

In our target they're both of p0 LLTs, so the default method eliminates this instruction while in our target it's necessary to keep it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101538



More information about the llvm-commits mailing list