[PATCH] D144749: [Attributor] Set up a dedicated simplification call back map for `GlobalVariable`

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 09:20:32 PST 2023


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG, two nits below.



================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:1922
+                                    const AbstractAttribute *AA,
+                                    bool &UsedAssumedInformation) {
+    for (auto &CB : GlobalVariableSimplificationCallbacks.lookup(&GV)) {
----------------
assert(has...())


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:247-253
   if (!GV->hasLocalLinkage() && !(GV->isConstant() && GV->hasInitializer()))
     return nullptr;
   if (!GV->hasInitializer())
     return UndefValue::get(&Ty);
 
+  if (!Initializer)
+    Initializer = GV->getInitializer();
----------------
Put these three conditionals in an else case. If the user registered a callback we assume that is the real deal.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144749/new/

https://reviews.llvm.org/D144749



More information about the llvm-commits mailing list