aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-09-05 22:49:34 +0000
committerVitaly Buka <vitalybuka@google.com>2019-09-05 22:49:34 +0000
commit9020f113770598f2064c1f19730aea5c1db754f6 (patch)
treeba593a68bd80f3f3c433238b2fd4ee0c33b20f98 /clang/lib/Frontend/CompilerInvocation.cpp
parentf54daffc2d73866312e6f50b75fe15035e62b4e8 (diff)
downloadllvm-9020f113770598f2064c1f19730aea5c1db754f6.zip
llvm-9020f113770598f2064c1f19730aea5c1db754f6.tar.gz
llvm-9020f113770598f2064c1f19730aea5c1db754f6.tar.bz2
[SimplifyCFG] Don't SimplifyBranchOnICmpChain with ExtraCase
Summary: Here we try to avoid issues with "explicit branch" with SimplifyBranchOnICmpChain which can check on undef. Msan by design reports branches on uninitialized memory and undefs, so we have false report here. In general msan does not like when we convert ``` // If at least one of them is true we can MSAN is ok if another is undefs if (a || b) return; ``` into ``` // If 'a' is undef MSAN will complain even if 'b' is true if (a) return; if (b) return; ``` Example Before optimization we had something like this: ``` while (true) { bool maybe_undef = doStuff(); while (true) { char c = getChar(); if (c != 10 && c != 13) continue break; } // we know that c == 10 || c == 13 if we get here, // so msan know that branch is not affected by maybe_undef if (maybe_undef || c == 10 || c == 13) continue; return; } ``` SimplifyBranchOnICmpChain will convert that into ``` while (true) { bool maybe_undef = doStuff(); while (true) { char c = getChar(); if (c != 10 && c != 13) continue; break; } // however msan will complain here: if (maybe_undef) continue; // we know that c == 10 || c == 13, so either way we will get continue switch(c) { case 10: continue; case 13: continue; } return; } ``` Reviewers: eugenis, efriedma Reviewed By: eugenis, efriedma Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67205 llvm-svn: 371138
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions