[PATCH] D31788: [ConstantFolding] Add folding for various math '__<func>_finite' routines generated from -ffast-math

Chris Chrulski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 16:37:28 PDT 2017


chrischr added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:1446
+    // __FINITE_MATH_ONLY__ enabled.
+    if (Name[0] == '_' && Name.size() > 2 && Name[1] == '_') {
+      switch (Name[2]) {
----------------
andrew.w.kaylor wrote:
> The Name[0] check here is redundant, but I suppose it's mostly harmless.
Good catch. Will fix.



================
Comment at: test/Transforms/ConstProp/calls-math-finite.ll:35
+
+; CHECK-NOT: call
+; CHECK: ret
----------------
andrew.w.kaylor wrote:
> Won't this test fail on targets where these functions were marked as unavailable?
Currently the test case is written without specifying a target triple, so the default OS value (UnknownOS) is in effect during the initialization of the TLI preventing the  TLI.setUnavailable calls from executing. 



https://reviews.llvm.org/D31788





More information about the llvm-commits mailing list