[PATCH] D70966: [ARM] Teach the Arm cost model that a Shift can be folded into other instructions

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 12:26:09 PST 2019


spatel added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:910
+      ArrayRef<const Value *> Args = ArrayRef<const Value *>(),
+      const Instruction *I = nullptr) const;
 
----------------
+1 to documenting the argument. Also, in InstSimplify and possibly some other places, this param is called the context instruction and spelled "CxtI". I've never liked that abbreviation, but that would still help the casual reader understand the intent.


================
Comment at: llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp:795-796
+
+    if (Opcode != Instruction::Shl && Opcode != Instruction::AShr &&
+        Opcode != Instruction::LShr)
+      return false;
----------------
This can use "isShift(unsigned Opcode)" from Instruction.h - or the class member version: I->isShift().


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70966/new/

https://reviews.llvm.org/D70966





More information about the llvm-commits mailing list