aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authortyker <tyker1@outlook.com>2019-10-31 00:11:18 +0100
committertyker <tyker1@outlook.com>2019-10-31 00:15:19 +0100
commitc3b06d0c393e533eab712922911d14e5a079fa5d (patch)
tree7e6e292e9ce1a5e879bbcaa87774d606c869d2e9 /clang/lib/Frontend/CompilerInvocation.cpp
parent5632d3756cd589a8139099317829a746dab650ee (diff)
downloadllvm-c3b06d0c393e533eab712922911d14e5a079fa5d.zip
llvm-c3b06d0c393e533eab712922911d14e5a079fa5d.tar.gz
llvm-c3b06d0c393e533eab712922911d14e5a079fa5d.tar.bz2
[InstCombine] keep assumption before sinking calls
Summary: in the following C code the branch is not removed by clang in O3. ``` int f1(char* p) { int i1 = __builtin_strlen(p); if (!p) return -1; return i1; } ``` The issue is that the call to strlen is sunk to the following block by instcombine. In its new place the call to strlen doesn't dominate the use in the icmp anymore so value tracking can't see that p cannot be null. This patch resolves the issue by inserting an assumption at the place of the call before sinking a call when that call can be used to prove an argument to be nonnull. This resolves this issue at O3. Reviewers: majnemer, xbolva00, fhahn, jdoerfert, spatel, efriedma Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69477
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions