[PATCH] D100923: [ConstFold] Constant fold load through invariant group intrinsics

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 23:23:11 PDT 2021


aeubanks created this revision.
Herald added subscribers: hiraditya, Prazek.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Loads should be able to look through invariant group intrinsics when
we're trying to constant fold.

This fixes some major code size regressions due to RTTI when
-fstrict-vtable-pointers is turned on.

Since invariant group intrinsics can't be constants,
ConstantFoldLoadFromConstPtr had to be changed to accept Values instead
of Constants. A majority of this patch is fixing up functions to work
with a Value instead of a Constant.

SymbolicallyEvaluateGEP had to have an option to strip pointers via
stripPointerCastsForAliasAnalysis() since we need that to simplify GEPs
that have an operand that derive from an invariant group intrinsic.
Otherwise we can never see that the GEP pointer operand could be a
constant GlobalVariable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100923

Files:
  llvm/include/llvm/Analysis/ConstantFolding.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/ExpandMemCmp.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Utils/Evaluator.cpp
  llvm/lib/Transforms/Utils/SCCPSolver.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/lib/Transforms/Utils/VNCoercion.cpp
  llvm/test/Transforms/InstCombine/invariant.group-load.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100923.339107.patch
Type: text/x-patch
Size: 30186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210421/55f573d1/attachment.bin>


More information about the llvm-commits mailing list