[PATCH] D138937: [AMDGPU] Update InstrCost calculation

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 11:50:12 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp:228
+      // skip bitcast for cost calculation
+      if (I.isCast())
+        continue;
----------------
I'm pretty sure this skips a lot more casts.

This also looks backwards. Opaque pointers avoid a lot of bitcasts, not introduce them


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp:272
       } else {
         ++FI.InstCost;
       }
----------------
Probably shouldn't count free instructions here. Rather than inventing a new cost counting, can we use TTI costs?


================
Comment at: llvm/test/CodeGen/AMDGPU/perfhint-instr-cost.ll:3
+; RUN: llc -march=amdgcn -debug-only=amdgpu-perf-hint -opaque-pointers=1 < %s 2>&1 | FileCheck %s
+define i32 @perfHintInstrCost(i8 addrspace(4)* %p1, i8 addrspace(4)* %p2, i8 addrspace(4)* %p3) #0 {
+; CHECK: MemInst cost: 3
----------------
This is adding a new test with typed pointers


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138937



More information about the llvm-commits mailing list