[PATCH] D45216: [Attributes] Add IntrinsicLoweredToCall attribute.

Matt Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 18:33:10 PDT 2018


mattd added a comment.

In https://reviews.llvm.org/D45216#1058779, @efriedma wrote:

> This is not whether the intrinsic is lowered to a call instruction, this is not whether an intrinsic is "metadata".


Correct, but having that data can be useful. I'm not trying to necessarily
change how norecurse is decided, rather I just want to prevent
certain intrinsics from having an influence.  What I envisioned was
to use such a "is metadata" attribute to completely ignore intrinsics
that we know should not have an influence on norecurse.  There are
other cases in the compiler where I'd also like to have this
"is metadata" information.

For norecurse, I would think that checking such an "is metadata" 
attribute in the for-loop of the following function would help prevent
debug intrinsics from influencing the placement of norecurse
attributes on a function:
https://llvm.org/doxygen/FunctionAttrs_8cpp_source.html#l01260

  for (Instruction &I : instructions(*F))
    if (auto CS = CallSite(&I)) {
      Function *Callee = CS.getCalledFunction();
      if (Callee && Callee->isAMetadataIntrinsic())  // Just an idea...
        continue;
      if (!Callee || Callee == F || !Callee->doesNotRecurse())
        // Function calls a potentially recursive function.
        return false;
    }




https://reviews.llvm.org/D45216





More information about the llvm-commits mailing list