summaryrefslogtreecommitdiff
path: root/compiler/optimizing/gvn.cc
diff options
context:
space:
mode:
author Artem Serov <artem.serov@linaro.org> 2018-06-05 20:54:42 +0100
committer Artem Serov <artem.serov@linaro.org> 2018-06-15 16:37:44 +0100
commit4d277ba858389980525c16c4b0655ee72af5a44c (patch)
tree5f8c522b1340e52a94af1d329cf069c74d1bb288 /compiler/optimizing/gvn.cc
parent0e3a330f4a545a6a2d352bd4a803c8387f54e76b (diff)
ART: Make GVN work with BoundType.
Support BoundType instruction treatment in GVN. Note: BoundType must not be a subject to LICM as it must not be moved from more control dependent basic blocks to less control dependent (e.g. hoisted out from the loop) due to semantics of bounding the type. Test: 477-checker-bound-type. Test: test-art-target, test-art-host. Change-Id: I64263d6ec7d9ad75d1fb07d3a89e9973be67682b
Diffstat (limited to 'compiler/optimizing/gvn.cc')
-rw-r--r--compiler/optimizing/gvn.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc
index 4863718518..e6b6326726 100644
--- a/compiler/optimizing/gvn.cc
+++ b/compiler/optimizing/gvn.cc
@@ -479,7 +479,10 @@ void GlobalValueNumberer::VisitBasicBlock(HBasicBlock* block) {
HInstruction* next = current->GetNext();
// Do not kill the set with the side effects of the instruction just now: if
// the instruction is GVN'ed, we don't need to kill.
- if (current->CanBeMoved()) {
+ //
+ // BoundType is a special case example of an instruction which shouldn't be moved but can be
+ // GVN'ed.
+ if (current->CanBeMoved() || current->IsBoundType()) {
if (current->IsBinaryOperation() && current->AsBinaryOperation()->IsCommutative()) {
// For commutative ops, (x op y) will be treated the same as (y op x)
// after fixed ordering.