[PATCH] D140467: [X86][Reduce] Preserve fast math flags when change it. NFCI

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 03:36:17 PST 2022


pengfei added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:14742
     Builder.getFastMathFlags().setAllowReassoc();
-    return Builder.CreateCall(F, {Ops[0], Ops[1]});
+    Value *FAdd = Builder.CreateCall(F, {Ops[0], Ops[1]});
+    Builder.getFastMathFlags() &= (FMF);
----------------
barannikov88 wrote:
> barannikov88 wrote:
> > Could be just:
> > ```
> >     return Builder.CreateCall(F, {Ops[0], Ops[1]})
> >         ->getFastMathFlags()
> >         .setAllowReassoc();
> > ```
> > so that you don't have to save and restore Builder's flags.
> > 
> No, it couldn't be, just tried :(
Thanks for trying it :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140467



More information about the cfe-commits mailing list