[llvm] r276690 - GlobalISel: add generic casts to IRTranslator

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 09:28:43 PDT 2016


On 11 Aug 2016, at 09:22, Quentin Colombet <qcolombet at apple.com> wrote:
> Yes, I know, but I thought we had a way to know whether or not they were nops and can use this information instead of checking the equality of the types.

> What I am talking about is:
> CastInst::isNoopCast

That function thinks that all bitcasts are nops (which they are in the sense that any sequence of them can be folded). It's there to deal with the fact that zext, trunc, fptosi and so on are CastInsts.

> I believe it should catch more cases than LLT equality, like on x86 all of then should be noop casts IIRC.

Probably, but I think that should be handled by combining or something. Ideally I think IRTranslator should be pretty much target-agnostic (except for the CallLowering of course).

> The opposite is also true (we could reuse the source if it is available and the def wasn’t set) ;).

Chains of bitcasts too, but for now a simple peephole is probably fine.

Tim.


More information about the llvm-commits mailing list