[PATCH] D128302: [AArch64][CostModel] Detects that ExtractElement at index is not free in AArch64 when result is used as integer.

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 13:56:04 PDT 2022


mingmingl marked 2 inline comments as done.
mingmingl added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1868
+        Instruction *UserI = dyn_cast<Instruction>(U.getUser());
+        // FIXME: Shall all users be of type Instruction?
+        if (!UserI)
----------------
nikic wrote:
> Yes, all users of an instruction are instructions, it's safe to use `cast` here.
thanks for taking a look! I looked at a few existing cpp and they also assume so.

Changing this to an assert then.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1879
+          // integer.
+          if (SI->getValueOperand() == SI->getOperand(U.getOperandNo()))
+            continue;
----------------
nikic wrote:
> This should probably be just `U.getOperandNo() == 0`?
I meant to check that the extract-element is used as the value, the source of store operation.

However, upon this comment, I realize that the extracted element could only be the source, since the destination should be a pointer type. Simplified the  store operation check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128302



More information about the llvm-commits mailing list