summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-07-28 22:50:43 +0000
committerVitaly Buka <vitalybuka@google.com>2016-07-28 22:50:43 +0000
commitcaca9da4ff3ae314a522e1eaa9ed2ece852ebfc6 (patch)
tree7c2ef4bfb02d3927d6a01bcfae59d93eb3740ff3 /llvm/lib/Transforms/InstCombine
parent4fa5041225ed56569f9db60d4399f867dff5085e (diff)
downloadbcm5719-llvm-caca9da4ff3ae314a522e1eaa9ed2ece852ebfc6.tar.gz
bcm5719-llvm-caca9da4ff3ae314a522e1eaa9ed2ece852ebfc6.zip
range
llvm-svn: 277066
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 8acff91345d..c78f105523c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -30,6 +30,8 @@ using namespace PatternMatch;
STATISTIC(NumSimplified, "Number of library calls simplified");
+extern cl::opt<bool> ClUseAfterScope;
+
/// Return the specified type promoted as it would be to pass though a va_arg
/// area.
static Type *getPromotedType(Type *Ty) {
@@ -1209,6 +1211,10 @@ static bool removeTriviallyEmptyRange(IntrinsicInst &I, unsigned StartID,
unsigned EndID, InstCombiner &IC) {
assert(I.getIntrinsicID() == StartID &&
"Start intrinsic does not have expected ID");
+ // Even if the range is empty asan need to poison memory to detect invalid
+ // access latter.
+ if (ClUseAfterScope)
+ return false;
BasicBlock::iterator BI(I), BE(I.getParent()->end());
for (++BI; BI != BE; ++BI) {
if (auto *E = dyn_cast<IntrinsicInst>(BI)) {
OpenPOWER on IntegriCloud