[PATCH] D111023: [ConstantFold] Refactor load folding

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 3 07:36:52 PDT 2021


nikic created this revision.
nikic added a reviewer: aeubanks.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This refactors load folding to happen in two cleanly separated steps: `ConstantFoldLoadFromConstPtr()` takes a pointer to load from and decomposes it into a constant initializer base and an offset. Then `ConstantFoldLoadFromConst()` loads from that initializer at the given offset. This makes the core logic independent of having actual GEP expressions (and those GEP expressions having certain structure) and will allow exposing `ConstantFoldLoadFromConst()` as an independent API in the future.


https://reviews.llvm.org/D111023

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
  llvm/test/Transforms/InstSimplify/load.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111023.376762.patch
Type: text/x-patch
Size: 14277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211003/967b0c2b/attachment.bin>


More information about the llvm-commits mailing list