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

Aleksandr Bezzubikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 07:23:30 PDT 2021


zuban32 added a comment.

In D101538#2769796 <https://reviews.llvm.org/D101538#2769796>, @qcolombet wrote:

>> 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.
>
> That sounds like you're abusing the IR here. Shouldn't you have a different addrspace here?
>
> FWIW, when we discussed the design of GISel internally originally we explicitly chose not to allow virtual overloading of the IR translation steps because that step follow what is represented in the IR.
> To make a parallel with SDISel, this is as if we would allow SDISelBuilder to be target specific.
>
> Bottom line, for just this one use case I feel that it doesn't make sense to allow virtual method everywhere yet.
>
> You could workaround that with introducing a pseudo/intrisinc in codegen prepare for instance.
>
> My 2 cents.
>
> Cheers,
> -Quentin

OK, thank you Quentin, Jay and Matt for your input, I understand it's kind of a bruteforce approach to make these function virtual, I'll try to consider another viable options


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