[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 22 12:44:53 PDT 2024
================
@@ -318,12 +320,12 @@
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
// CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-cc1"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-mreassociate"
-// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-mreassociate"
+// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-funsafe-math-optimizations"
----------------
andykaylor wrote:
I'm not sure what this case was originally trying to do, but it seems that I can make CHECK, CHECK-NOT, and CHECK-SAME in a limited way. Specifically, CHECK-NOT doesn't reset the line used for CHECK-SAME. So if I have checks like this:
```
CHECK: foo
CHECK-NOT: bar
CHECK-SAME: fubar
CHECK-NOT: bar
```
The string "foo fubar" will pass, the string "foo bar fubar" will fail the first CHECK-NOT test, and "foo fubar bar" will fail the second CHECK-NOT test.
I think I can update this test such that it continues to use "-cc1" as the starting check for the options produced, and uses CHECK-SAME for the FP-related options it expects to be produced, and any options that should not be produced can be verified with a CHECK-NOT before and after the CHECK-SAME.
https://github.com/llvm/llvm-project/pull/89473
More information about the cfe-commits
mailing list