[PATCH] D137454: [InstCombine] Avoid passing pow attributes to sqrt

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 13:51:21 PST 2022


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:2165
+      AttributeList Attrs;
+      Sqrt = getSqrtCall(Base, Attrs, Pow->doesNotAccessMemory(), M, B, TLI);
       if (!Sqrt)
----------------
Saldivarcher wrote:
> spatel wrote:
> > spatel wrote:
> > > Do we need to name the default/empty AttributeList if this is the only use? 
> > > Ie, can the code be shorter? 
> > >       Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), M, B, TLI);
> > I tried to make the existing code around here easier to understand with:
> > bff6880a5f89
> Your changes LGTM, I like the `Attrs` -> `NoAttrs` change, really helps with readability. The `AttributeList()` change is alright as well. Should this change just include the test then? Or should I close it completely? 
I left this case alone, so there wouldn't be a conflict. You can either name the variable "NoAttrs" or default construct it in the getSqrtCall(), and then we should be good. Do you have commit access?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137454



More information about the llvm-commits mailing list