[PATCH] D111660: [FuncSpec] Make sure function is actually the callee before trying to specialize.

duk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 05:08:27 PDT 2021


duck-37 updated this revision to Diff 379348.
duck-37 added a comment.

Change from if statement to assert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111660

Files:
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp


Index: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -662,6 +662,11 @@
       if (!isa<CallInst>(U) && !isa<InvokeInst>(U))
         continue;
       auto &CS = *cast<CallBase>(U);
+
+      // This should not happen at the moment; however, it may if we start 
+      // specializing functions that have their addresses taken.
+      assert(CS.getCalledFunction() != F);
+
       // If the call site has attribute minsize set, that callsite won't be
       // specialized.
       if (CS.hasFnAttr(Attribute::MinSize)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111660.379348.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/2308a93f/attachment.bin>


More information about the llvm-commits mailing list