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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 12:07:12 PDT 2016


> On Aug 11, 2016, at 9:28 AM, Tim Northover <tnorthover at apple.com> wrote:
> 
> 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 see, I thought since it was using the data layout it was doing smarter thing.

> 
>> 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).

Agree.

> 
>> 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.

Yeah, I wanted to avoid the obvious useless ones.

> 
> Tim.



More information about the llvm-commits mailing list