[PATCH] D46236: [Driver, CodeGen] rename options to disable an FP cast optimization
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 29 08:53:29 PDT 2018
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
Overall makes sense to me.
================
Comment at: docs/ReleaseNotes.rst:94
+ :option:`-fno-strict-float-cast-overflow` -
+ When a floating-point value is not representable in a casted-to integer
+ type, the code has undefined behavior according to the language standard.
----------------
```
- in a casted-to integer type
+ in destination integer type
```
?
================
Comment at: docs/ReleaseNotes.rst:96
+ type, the code has undefined behavior according to the language standard.
+ Clang will not guarantee any particular result in that event. With the
+ 'no-strict' option, Clang attempts to match the overflowing behavior of
----------------
s/event/case/ ?
================
Comment at: docs/UsersManual.rst:1260
- Enable a workaround for code that casts floating-point values to
- integers and back to floating-point. If the floating-point value
- is not representable in the intermediate integer type, the code is
- incorrect according to the language standard. This flag will attempt
- to generate code as if the result of an overflowing conversion matches
- the overflowing behavior of a target's native float-to-int conversion
- instructions.
+ When a floating-point value is not representable in a casted-to integer
+ type, the code has undefined behavior according to the language standard.
----------------
same
================
Comment at: docs/UsersManual.rst:1262
+ type, the code has undefined behavior according to the language standard.
+ Clang will not guarantee any particular result in that event. With the
+ 'no-strict' option, Clang attempts to match the overflowing behavior of
----------------
same
================
Comment at: include/clang/Driver/Options.td:1033
+def fstrict_float_cast_overflow : Flag<["-"],
+ "fstrict-float-cast-overflow">, Group<f_Group>, Flags<[CC1Option]>;
+def fno_strict_float_cast_overflow : Flag<["-"],
----------------
Maybe add `HelpText<"">` to both of them, just to explain what they are,
specify that the first is the default, and the second relaxes language rules to help broken code.
================
Comment at: test/CodeGen/no-junk-ftrunc.c:7
// RUN: %clang_cc1 -S %s -emit-llvm -o - | FileCheck %s --check-prefix=DEFAULT
// DEFAULT-LABEL: main
----------------
It wouldn't hurt to duplicate this run-line, and explicitly pass `-fno-strict-float-cast-overflow`.
https://reviews.llvm.org/D46236
More information about the cfe-commits
mailing list