summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2019-02-04 05:04:19 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2019-02-04 05:04:19 +0000
commit437ee05885215339bfda865646b10c6a05626660 (patch)
treea1a51cdd1863988615d8f81c40d0904f01f19265 /llvm
parentb5e945c260975c25c5ee423c081c98b78d959e0a (diff)
downloadbcm5719-llvm-437ee05885215339bfda865646b10c6a05626660.tar.gz
bcm5719-llvm-437ee05885215339bfda865646b10c6a05626660.zip
[SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes
Currently, SCEV creates SCEVUnknown for every node of unreachable code. If we have a huge amounts of such code, we will be littering SE with these nodes. We could just state that they all are undef and save some memory. Differential Revision: https://reviews.llvm.org/D57567 Reviewed By: sanjoy llvm-svn: 353017
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
-rw-r--r--llvm/test/Analysis/ScalarEvolution/unreachable-code.ll2
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c554f9c306f..fcf6a2bfa9f 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6144,7 +6144,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// to obey basic rules for definitions dominating uses which this
// analysis depends on.
if (!DT.isReachableFromEntry(I->getParent()))
- return getUnknown(V);
+ return getUnknown(UndefValue::get(V->getType()));
} else if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
return getConstant(CI);
else if (isa<ConstantPointerNull>(V))
diff --git a/llvm/test/Analysis/ScalarEvolution/unreachable-code.ll b/llvm/test/Analysis/ScalarEvolution/unreachable-code.ll
index 51d93981800..69a7e39839a 100644
--- a/llvm/test/Analysis/ScalarEvolution/unreachable-code.ll
+++ b/llvm/test/Analysis/ScalarEvolution/unreachable-code.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
; CHECK: %t = add i64 %t, 1
-; CHECK: --> %t
+; CHECK: --> undef
define void @foo() {
entry:
OpenPOWER on IntegriCloud