[llvm] r353017 - [SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 3 21:04:19 PST 2019
Author: mkazantsev
Date: Sun Feb 3 21:04:19 2019
New Revision: 353017
URL: http://llvm.org/viewvc/llvm-project?rev=353017&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=353017&r1=353016&r2=353017&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Feb 3 21:04:19 2019
@@ -6144,7 +6144,7 @@ const SCEV *ScalarEvolution::createSCEV(
// 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))
Modified: llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll?rev=353017&r1=353016&r2=353017&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll Sun Feb 3 21:04:19 2019
@@ -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:
More information about the llvm-commits
mailing list