This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`
ClosedPublic

Authored by tianshilei1992 on Feb 24 2023, 10:25 AM.

Details

Summary

Currently we don't check call backs for global variable simplification.
What's more, the only way that we can register a simplification call back for
global variable is through its initializer (essentially a Constant *). It might
not correspond to the right global variable. In this patch, we set up a dedicated
simplification map for GlobalVariable.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2023, 10:25 AM
tianshilei1992 requested review of this revision.Feb 24 2023, 10:25 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

differentiate between no callback and unknown value

tianshilei1992 retitled this revision from [AbstractAttributor] Set up a dedicated simplification call back map for `GlobalVariable` to [Attributor] Set up a dedicated simplification call back map for `GlobalVariable`.Feb 24 2023, 6:38 PM
jdoerfert accepted this revision.Mar 1 2023, 9:20 AM

LG, two nits below.

llvm/include/llvm/Transforms/IPO/Attributor.h
1921

assert(has...())

llvm/lib/Transforms/IPO/Attributor.cpp
247–255

Put these three conditionals in an else case. If the user registered a callback we assume that is the real deal.

This revision is now accepted and ready to land.Mar 1 2023, 9:20 AM
tianshilei1992 marked 2 inline comments as done.

rebase and fix comments

This revision was landed with ongoing or failed builds.Apr 20 2023, 9:08 PM
This revision was automatically updated to reflect the committed changes.