[PATCH] [AArch64] Enhance rematerialization by adding a new API isAsCheapAsAMove in TargetInstroInfo

Jiangning Liu liujiangning1 at gmail.com
Wed Jul 9 18:36:32 PDT 2014


Hi Quentin,

Updated with the latest comments.

BTW, for instructions updating NCZV flags, actually I think it still make
sense to mark them as rematerializable. Essentially the algorithm of
rematerialization should take care of the final decision. For example, an
adds instruction can still be rematerialized if only the flag is not really
used by any instruction at all on control flow, or the flag may be
overridden by another adds instruction. But I think it's OK to do it
conservatively at this moment, so I agree to remove all instructions
updating flags.

Thanks,
-Jiangning

2014-07-09 22:28 GMT+08:00 Quentin Colombet <qcolombet at apple.com>:

> Hi Jiangning,
>
> A few comments on the second patch (the first one looks good).
>
> +// FIXME: this implementation should be micro-architecture dependent, so a
> +// micro-architecture target hook should be introduced here in future.
> +bool AArch64InstrInfo::isAsCheapAsAMove(const MachineInstr *MI) const {
> +  if (Subtarget.isCortexA57() || Subtarget.isCortexA53()) {
> +    switch (MI->getOpcode()) {
> +    default:
> +      return false;
> […]
> +  }
> +
> +  return MI->isAsCheapAsAMove();
> +}
> +
>
> To match LLVM guidelines, use an early exit when the subtarget does not
> match:
> if (!Subtarget.isCortexA57() && !Subtarget.isCortexA53())
>   return MI->isAsCheapAsAMove();
> switch (MI->getOpcode()) {
> […]
>
> +    case AArch64::ANDSWri:
> +    case AArch64::ANDSXri:
>
> I believe this is a remaining of the initial patch. The S variant are not
> rematerializable.
>
> Thanks,
> -Quentin
>
> http://reviews.llvm.org/D4361
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/f07b0f43/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Implement-AArch64-TTI-interface-isAsCheapAsAMove.patch
Type: text/x-patch
Size: 5849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/f07b0f43/attachment.bin>


More information about the llvm-commits mailing list