diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-03-27 23:58:37 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-03-27 23:58:37 +0000 |
commit | 82fe6aea407a5a09a6131452ce622087ba83880d (patch) | |
tree | f6341892ef58ddae569f8b11afc32135a6cd9896 /include/clang/Frontend/CodeGenOptions.h | |
parent | ba1030698dbc276db86b11c5329a1edee8a1805e (diff) |
Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.
Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.
I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CodeGenOptions.h')
-rw-r--r-- | include/clang/Frontend/CodeGenOptions.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h index 59509331a0..e844f8869c 100644 --- a/include/clang/Frontend/CodeGenOptions.h +++ b/include/clang/Frontend/CodeGenOptions.h @@ -94,6 +94,7 @@ public: unsigned SaveTempLabels : 1; /// Save temporary labels. unsigned SimplifyLibCalls : 1; /// Set when -fbuiltin is enabled. unsigned SoftFloat : 1; /// -soft-float. + unsigned StrictEnums : 1; /// Optimize based on strict enum definition. unsigned TimePasses : 1; /// Set when -ftime-report is enabled. unsigned UnitAtATime : 1; /// Unused. For mirroring GCC optimization /// selection. @@ -205,6 +206,7 @@ public: SaveTempLabels = 0; SimplifyLibCalls = 1; SoftFloat = 0; + StrictEnums = 0; TimePasses = 0; UnitAtATime = 1; UnrollLoops = 0; |