From 6d05700c620d2bca95fd046969753f71aa015ab4 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Mon, 9 Apr 2018 15:39:58 -0700 Subject: Run GVN earlier. Rationale: Running GVN earlier allows for better subsequent instruction simplifation. For example, running GVN before select generation also finds the MIN in: if (x > a[i]) x = a[i]; Bug: b/74026074 Test: test-art-host,target Change-Id: I633046375637c7809a3603fdf7c5cf77e8f21167 --- compiler/optimizing/loop_optimization.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/optimizing/loop_optimization.cc') diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index c0c721de63..1462404932 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -1353,6 +1353,11 @@ bool HLoopOptimization::VectorizeDef(LoopNode* node, HInstruction* index = instruction->InputAt(1); HInstruction* value = instruction->InputAt(2); HInstruction* offset = nullptr; + // For narrow types, explicit type conversion may have been + // optimized way, so set the no hi bits restriction here. + if (DataType::Size(type) <= 2) { + restrictions |= kNoHiBits; + } if (TrySetVectorType(type, &restrictions) && node->loop_info->IsDefinedOutOfTheLoop(base) && induction_range_.IsUnitStride(instruction, index, graph_, &offset) && -- cgit v1.2.3-59-g8ed1b