diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2016-10-04 00:03:55 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2016-10-04 00:03:55 +0000 |
commit | 74bed9d7575973202a38743722def09fee51413b (patch) | |
tree | 4ecfe64dc908a1dd3e9c7498b85b27656acae6b5 /llvm/lib/Analysis/GlobalsModRef.cpp | |
parent | 396bfdd7076325be148e1e95c433b78849c1083d (diff) | |
download | llvm-74bed9d7575973202a38743722def09fee51413b.zip llvm-74bed9d7575973202a38743722def09fee51413b.tar.gz llvm-74bed9d7575973202a38743722def09fee51413b.tar.bz2 |
Make GlobalsAA ignore dead constant expressions.
Slightly improves the precision of GlobalsAA in certain situations, and
makes the behavior of optimization passes more predictable.
Differential Revision: https://reviews.llvm.org/D24104
llvm-svn: 283165
Diffstat (limited to 'llvm/lib/Analysis/GlobalsModRef.cpp')
-rw-r--r-- | llvm/lib/Analysis/GlobalsModRef.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp index 0da888d..d29b970 100644 --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -366,6 +366,8 @@ bool GlobalsAAResult::AnalyzeUsesOfPointer(Value *V, } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(I)) { if (!isa<ConstantPointerNull>(ICI->getOperand(1))) return true; // Allow comparison against null. + } else if (Constant *C = dyn_cast<Constant>(I)) { + return C->isConstantUsed(); } else { return true; } |