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

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 14:52:32 PDT 2021


qcolombet added a comment.

> 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


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