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

Quentin Colombet qcolombet at apple.com
Thu Jul 10 06:53:54 PDT 2014


> On Jul 9, 2014, at 6:36 PM, Jiangning Liu <liujiangning1 at gmail.com> wrote:
> 
> 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.

I agree, but right now the algorithm will bail on such cases, so we better save the compile time right away.

> 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
> 
> 
> 
> <0002-Implement-AArch64-TTI-interface-isAsCheapAsAMove.patch>

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


More information about the llvm-commits mailing list