[PATCH] D75815: [InstCombine] Simplify calls with "returned" attribute

Alexander Potapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 07:01:02 PDT 2020


glider added a comment.



> Yeah, like i said, `noinline` is insufficient here, and i don't actually
>  think we currently have the right tool to block any such transform:

Do you think it makes sense to check for noinline before transforming the call into the argument, i.e.:

  if (!Call.use_empty() && !Call.isMustTailCall()) {
    Function *Fn = dyn_cast<Function>(Callee);
    if (Fn && Fn->hasFnAttribute(Attribute::NoInline))
      if (Value *ReturnedArg = Call.getReturnedArgOperand())
        return replaceInstUsesWith(Call, ReturnedArg);
  }



>> You're right, we'll have to write them down. But in the case of noinline attribute langref is pretty clear on this subject: "This attribute indicates that the inliner should never inline this function in any situation."
> 
> To be noted, i'm not currently saying that the expected behavior is unreasonable,
>  i'm merely saying that the behavior was not actually guaranteed but accidental,
>  and likely partial.

I agree. Let's concentrate on noinline then, as we can afford making our attributes imply noinline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75815





More information about the llvm-commits mailing list