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

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 05:21:21 PST 2022


samparker created this revision.
samparker added reviewers: tlively, sbc100, sunfish, asb.
Herald added subscribers: pmatos, StephenFan, ecnelises, mgrang, zzheng, hiraditya, jgravelle-google, dschuff.
Herald added a project: All.
samparker requested review of this revision.
Herald added a subscriber: aheejin.
Herald added a project: LLVM.

Workaround the shortcomings of LoopStrengthReduce and ScalarEvolutionExpander to allow inbounds getelemenptr instructions, in unrolled loops, to reach the backend. This enables greater usage of memory operations with immediate offsets.

The pass simply pattern matches geps, in the form: (getelementptr ptr %base (or i32 %reg_offset, i32 constant)) and then creates a new base from %base and %reg_offset, using pointer arithmetic. This is then shared amongst the geps, all of each can then use an immediate index too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139415

Files:
  llvm/lib/Target/WebAssembly/CMakeLists.txt
  llvm/lib/Target/WebAssembly/WebAssembly.h
  llvm/lib/Target/WebAssembly/WebAssemblyOptimizeGEPs.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/optimize-geps.ll
  llvm/test/CodeGen/WebAssembly/unrolled-mem-indices.ll
  llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139415.480441.patch
Type: text/x-patch
Size: 54105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221206/4860aac1/attachment.bin>


More information about the llvm-commits mailing list