[PATCH] D155843: [Analysis] Analysis of storing unchanged loaded value

Aleksei Romanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 07:25:20 PDT 2023


ara-sc created this revision.
ara-sc added reviewers: anton-afanasyev, asi-sc, RKSimon, nikic.
ara-sc added a project: LLVM.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
ara-sc requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.

Presumably patterns of the following kind could be optimized:

  %0 = load i8, ptr %c, align 1
  store i8 %0, ptr %a, align 1
  %1 = load i8, ptr %c, align 1
  store i8 %1, ptr %b, align 1

InstCombine is responsible for these optimization. Only this pass (InstCombinerImpl::visitLoadInst) uses llvm::FindAvailableLoadedValue to find previous available loads.
So we can add simple helper to get rid of the redundant code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155843

Files:
  llvm/lib/Analysis/Loads.cpp
  llvm/test/Transforms/InstCombine/load-elimination.ll
  llvm/test/Transforms/InstCombine/load.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155843.542502.patch
Type: text/x-patch
Size: 5707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/32d27d0e/attachment.bin>


More information about the llvm-commits mailing list