[PATCH] D139415: [RFC][WebAssembly] Optimize GEPs

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 10:18:10 PST 2022


tlively added inline comments.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyOptimizeGEPs.cpp:138
+
+  // Addresses are currently hardcoded to use i32.
+  if (ST.hasAddr64()) {
----------------
Would this be hard to change? Wasm64 is generally supported elsewhere in LLVM these days.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyOptimizeGEPs.cpp:166-167
+  Value *BasePtr = GEP->getPointerOperand();
+  unsigned Key = getBaseOffsetHash(BasePtr, RegOffset);
+  Candidates[Key].emplace_back(GEP, ImmOffset);
+  if (!BaseOffsetPairs.count(Key)) {
----------------
Why use a hash value as the key? Wouldn't it be better to use the pair itself as the key?


================
Comment at: llvm/test/CodeGen/WebAssembly/optimize-geps.ll:6
+
+define hidden void @one_dim(ptr nocapture noundef readonly %arg, ptr nocapture noundef readonly %arg1, ptr nocapture noundef writeonly %arg2) {
+; CHECK-LABEL: @one_dim(
----------------
Would it be possible to have a smaller test case? It's hard to tell what to look at here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139415



More information about the llvm-commits mailing list