[PATCH] D149476: [FuncSpec] Fix inconsistent treatment of global variables

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 12:28:50 PDT 2023


chill created this revision.
Herald added subscribers: hoy, snehasish, ormris, hiraditya.
Herald added a project: All.
chill requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

There are a few inaccuracies with how FuncSpec handles global variables.

When specialisation on non-const global variables is disabled (the default)
the pass could nevertheless perform some specializations, e.g. on a constant
GEP expression, or on a SSA variable, for which the Solver has determined
it has the value of a global variable.

When specialisation on non-const global variables is enabled, the pass would
skip non-scalars, e.g. a global array, but this should be completely inconsequential,
a pointer is a pointer.


https://reviews.llvm.org/D149476

Files:
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
  llvm/test/Transforms/FunctionSpecialization/compiler-crash-promote-alloca.ll
  llvm/test/Transforms/FunctionSpecialization/global-var-constants.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149476.518017.patch
Type: text/x-patch
Size: 4489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/adec3a3c/attachment.bin>


More information about the llvm-commits mailing list