This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Add reduction for special globals like llvm.used.
ClosedPublic

Authored by fhahn on Oct 28 2020, 5:22 AM.

Details

Summary

This patch adds a reduction of 'special' globals that lead to further
reductions (e.g. alias or regular globals reduction) being less efficient
because there are special constraints on values referenced in those
special globals. For example, values in @llvm.used and
@llvm.compiler.used need to be named, so replacing all uses of an
alias/global with undef or a different unnamed constant results in
invalid IR.

More details:
https://llvm.org/docs/LangRef.html#intrinsic-global-variables

Diff Detail

Event Timeline

fhahn created this revision.Oct 28 2020, 5:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2020, 5:22 AM
Herald added a subscriber: mgorny. · View Herald Transcript
fhahn requested review of this revision.Oct 28 2020, 5:22 AM
fhahn updated this revision to Diff 301250.Oct 28 2020, 5:23 AM

Fix comment, padding.

fhahn updated this revision to Diff 301262.Oct 28 2020, 6:15 AM

rebase after landing alias reduction

A nit and a question, but i don't really have an opinion on the functionality here.

llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
25

static StringRef

36

Do we want to be more fine-grained than that?
Should this be per-use?

fhahn updated this revision to Diff 303947.Nov 9 2020, 11:33 AM

Use const char * instead of auto.

fhahn marked an inline comment as done.Nov 9 2020, 11:35 AM
fhahn added inline comments.
llvm/tools/llvm-reduce/deltas/ReduceSpecialGlobals.cpp
25

Update to use const char *.

36

Hm, I guess it might be helpful, but I haven't encountered any cases where it would be needed/beneficial in practice. I would prefer to only cross that bridge once it becomes an issue, but I can also update this patch.

fhahn updated this revision to Diff 304142.Nov 10 2020, 4:53 AM
fhahn marked an inline comment as done.

Use StringRef instead of const char *

lebedev.ri accepted this revision.Nov 10 2020, 5:13 AM

Thanks. I don't really have comments on the idea, but the logic seems in-line with the rest.

This revision is now accepted and ready to land.Nov 10 2020, 5:13 AM
This revision was landed with ongoing or failed builds.Nov 11 2020, 3:25 AM
This revision was automatically updated to reflect the committed changes.

http://lab.llvm.org:8011/#/builders/114 (the string "clang-cmake-aarch64-global-isel" contains "global") failed for the past month... Fixed it with f314bcffa3c6083079831dde4e7bc124a25e0c04