[PATCH] D126190: [InstCombine] Add combine for fcmp sqrt(x),C --> fcmp x,C*C

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 10:44:13 PDT 2022


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:6785
+      Constant *C = ConstantFP::get(X->getType(), *CF);
+      Instruction *FCmp = new FCmpInst(Pred, X, ConstantExpr::getFMul(C, C));
+      FCmp->setFastMathFlags(I.getFastMathFlags());
----------------
What happens if C*C overflows or underflows? Unless there's some reason to diverge from the behavior in the gcc bug link (see earlier comment from @xbolva00 ), we should try to have the same rules for when this transform is allowed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126190



More information about the llvm-commits mailing list