[PATCH] D58260: [INLINER] allow inlining of blockaddresses if sole uses are callbrs

Stephen Hines via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 00:02:43 PDT 2019


srhines added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LazyCallGraph.h:1094
+              break;
+            }
         if (Visited.insert(BA->getFunction()).second)
----------------
nickdesaulniers wrote:
> Is there a better way to express `SomeConstant->getFunction()`?  I guess not, since the constant can appear in multiple functions?  Is there a better way to do what I'm trying to do here?
I don't think there is a much better way to detect this, but BA->getFunction() will always return the same result here, so abstracting that out (e.g. FunctionContainingBlockAddress) would make this more obvious.

One other (possibly silly) question. Is it possible for a use of a blockaddress to be not contained in an Instruction (i.e. as part of the definition of some other global constant)? I don't think that makes sense in the IR, so perhaps it is forbidden some other way, but I just wanted to double check.


================
Comment at: llvm/include/llvm/Analysis/LazyCallGraph.h:1096
         if (Visited.insert(BA->getFunction()).second)
-          Worklist.push_back(BA->getFunction());
+          // If the blockaddress' function it refers to is a function it's not
+          // defined within, visit the other function.
----------------
"If the blockaddress is used outside of the function it is defined within ..."


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58260





More information about the llvm-commits mailing list