[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
Thu May 11 14:48:59 PDT 2017


chrischr added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:1467
+      }
+    }
   }
----------------
andrew.w.kaylor wrote:
> andrew.w.kaylor wrote:
> > This needs an 'else return false'.
> After a little more thought, I think I prefer this to 'else return false':
> ```
>     // The '12' here is the length of the shortest name that can match.
>     // We need to check the size before looking at Name[1] and Name[2]
>     // so we may as well check a limit that will eliminate mismatches.
>     if (Name.size() < 12 || Name[1] != '_')
>       return false;
>     switch (Name[2]) {
>     <...>
> 
> ```
> Does that look OK?
ah, yes, there does need to be a 'return false' somewhere. The change to the check for string length looks good to me.



https://reviews.llvm.org/D31788





More information about the llvm-commits mailing list