summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Mingyao Yang <mingyao@google.com> 2015-04-26 18:23:01 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-04-26 18:23:02 +0000
commitf382eff130a5d90c34b3f09c4c61cb50cacd4c54 (patch)
tree07dd1b8e0cdf5c078776d6b64aa3813a80182bb6 /compiler/optimizing/nodes.cc
parentadf15974e0a0a2b0e6dc311ff5701b87ca15964a (diff)
parent206d6fd6cae5ba8c4d5f0e230111fe77b9d5c0a5 (diff)
Merge "Deoptimization-based BCE for unknown loop bounds."
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index c158ddf4ee..ca470f4988 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -498,6 +498,28 @@ void HEnvironment::CopyFrom(HEnvironment* env) {
}
}
+void HEnvironment::CopyFromWithLoopPhiAdjustment(HEnvironment* env,
+ HBasicBlock* loop_header) {
+ DCHECK(loop_header->IsLoopHeader());
+ for (size_t i = 0; i < env->Size(); i++) {
+ HInstruction* instruction = env->GetInstructionAt(i);
+ SetRawEnvAt(i, instruction);
+ if (instruction == nullptr) {
+ continue;
+ }
+ if (instruction->IsLoopHeaderPhi() && (instruction->GetBlock() == loop_header)) {
+ // At the end of the loop pre-header, the corresponding value for instruction
+ // is the first input of the phi.
+ HInstruction* initial = instruction->AsPhi()->InputAt(0);
+ DCHECK(initial->GetBlock()->Dominates(loop_header));
+ SetRawEnvAt(i, initial);
+ initial->AddEnvUseAt(this, i);
+ } else {
+ instruction->AddEnvUseAt(this, i);
+ }
+ }
+}
+
void HEnvironment::RemoveAsUserOfInput(size_t index) const {
const HUserRecord<HEnvironment*> user_record = vregs_.Get(index);
user_record.GetInstruction()->RemoveEnvironmentUser(user_record.GetUseNode());