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

Quentin Colombet qcolombet at apple.com
Wed Jul 9 07:28:59 PDT 2014

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.



More information about the llvm-commits mailing list