diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-17 23:09:05 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-22 09:35:08 +0100 |
commit | 25fde612b0df01a086cd4c801b7bd3a10e93a0e9 (patch) | |
tree | d546b9af302dfc1710566e66e55d5b88a9f4f69c /compiler | |
parent | ff82263e2b96ad099c56c19b91c2286baaf82fa7 (diff) | |
download | art-25fde612b0df01a086cd4c801b7bd3a10e93a0e9.zip art-25fde612b0df01a086cd4c801b7bd3a10e93a0e9.tar.gz art-25fde612b0df01a086cd4c801b7bd3a10e93a0e9.tar.bz2 |
Fix a bug in optimizing when the null constant has been DCE.
If it has been DCE, we should create a new one, instead of
using the old one.
Also move the first DCE to a place where it could actually
be useful.
bug:21870788
(cherry picked from commit 18e6873c469b48aaed22148451523479eece98e3)
Change-Id: I3b3ab2dafe8ce5fb60868fd1a6ef0eeefe666e0c
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/optimizing/nodes.cc | 5 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index c294294..fb150c3 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -287,7 +287,10 @@ void HGraph::InsertConstant(HConstant* constant) { } HNullConstant* HGraph::GetNullConstant() { - if (cached_null_constant_ == nullptr) { + // For simplicity, don't bother reviving the cached null constant if it is + // not null and not in a block. Otherwise, we need to clear the instruction + // id and/or any invariants the graph is assuming when adding new instructions. + if ((cached_null_constant_ == nullptr) || (cached_null_constant_->GetBlock() == nullptr)) { cached_null_constant_ = new (arena_) HNullConstant(); InsertConstant(cached_null_constant_); } diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 5632434..64d6023 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -342,9 +342,9 @@ static void RunOptimizations(HGraph* graph, HOptimization* optimizations[] = { &intrinsics, - &dce1, &fold1, &simplify1, + &dce1, &inliner, // BooleanSimplifier depends on the InstructionSimplifier removing redundant // suspend checks to recognize empty blocks. |