[PATCH] D107622: [FuncSpec] Return changed if function is changed by tryToReplaceWithConstant

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 01:53:45 PDT 2021


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

LGTM.

The remark about the comment was a nit anyway. Feel free to modify or omit it before committing.



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:765
         for (auto &I : make_early_inc_range(BB))
-          FS.tryToReplaceWithConstant(&I);
+          Changed |= FS.tryToReplaceWithConstant(&I);
       }
----------------
ChuanqiXu wrote:
> SjoerdMeijer wrote:
> > I think this now deserves a comment.
> hmm, I think it is easy to know that `tryToReplaceWithConstant` may change the function. I tried to add comments for this. But I find my words are a little redundant. I would make it if there is any good suggestion.
I thought the idea was that this:

   // FIXME: The solver may make changes to the function here, so set Changed, even if later
   // function specialization does not trigger.


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

https://reviews.llvm.org/D107622



More information about the llvm-commits mailing list