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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 09:22:26 PDT 2016


> On Aug 10, 2016, at 9:20 AM, Tim Northover <tnorthover at apple.com> wrote:
> 
> Thanks for the review Quentin.
> 
>> On 9 Aug 2016, at 18:10, Quentin Colombet <qcolombet at apple.com> wrote:
>> Shouldn’t we test isNoOpCast or something like that instead?
>> 
>> I.e., having v2i32 becoming v8i8 should also produce a copy.
> 
> Unfortunately not. bitcasts aren't necessarily nops at this level.

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

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

> They're defined to be equivalent to a store/load pair and (for example) big-endian NEON's in-register representation is defined in terms of ld1/st1 instructions, which means that vector bitcasts are REV instructions. See arm64-big-endian-bitconverts.ll for examples.
> 
>> 
>>> +    MIRBuilder.buildInstr(TargetOpcode::COPY, getOrCreateVReg(CI),
>>> +                          getOrCreateVReg(*CI.getOperand(0)));
>> 
>> Although this is correct, I’d like to be a little smarter here. Basically, I would like that we directly use CI.getOperand(0)’s vreg if CI hasn’t been created yet. I.e., I’d like we avoid creating copies if we don’t have to.
> 
> Sounds like a good idea, I'll work on it.

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

Cheers,
-Quentin

> 
> Tim.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160811/f8a5b61e/attachment.html>


More information about the llvm-commits mailing list