Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: src/IceInst.cpp

Issue 1215443002: Fixes bug on conditional branch where the targets are the same. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Clean up test. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/cond-br-same-target.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// 1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the Inst class, primarily the various 10 // This file implements the Inst class, primarily the various
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source) 265 InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source)
266 : InstHighLevel(Func, Inst::Assign, 1, Dest) { 266 : InstHighLevel(Func, Inst::Assign, 1, Dest) {
267 addSource(Source); 267 addSource(Source);
268 } 268 }
269 269
270 // If TargetTrue==TargetFalse, we turn it into an unconditional 270 // If TargetTrue==TargetFalse, we turn it into an unconditional
271 // branch. This ensures that, along with the 'switch' instruction 271 // branch. This ensures that, along with the 'switch' instruction
272 // semantics, there is at most one edge from one node to another. 272 // semantics, there is at most one edge from one node to another.
273 InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue, 273 InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue_,
274 CfgNode *TargetFalse) 274 CfgNode *TargetFalse_)
275 : InstHighLevel(Func, Inst::Br, 1, nullptr), TargetFalse(TargetFalse), 275 : InstHighLevel(Func, Inst::Br, 1, nullptr), TargetFalse(TargetFalse_),
276 TargetTrue(TargetTrue) { 276 TargetTrue(TargetTrue_) {
277 if (TargetTrue == TargetFalse) { 277 if (TargetTrue == TargetFalse) {
278 TargetTrue = nullptr; // turn into unconditional version 278 TargetTrue = nullptr; // turn into unconditional version
279 } else { 279 } else {
280 addSource(Source); 280 addSource(Source);
281 } 281 }
282 } 282 }
283 283
284 InstBr::InstBr(Cfg *Func, CfgNode *Target) 284 InstBr::InstBr(Cfg *Func, CfgNode *Target)
285 : InstHighLevel(Func, Inst::Br, 0, nullptr), TargetFalse(Target), 285 : InstHighLevel(Func, Inst::Br, 0, nullptr), TargetFalse(Target),
286 TargetTrue(nullptr) {} 286 TargetTrue(nullptr) {}
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 // preserve these. 934 // preserve these.
935 return true; 935 return true;
936 } 936 }
937 if (!Dest->hasReg() && !SrcVar->hasReg() && 937 if (!Dest->hasReg() && !SrcVar->hasReg() &&
938 Dest->getStackOffset() == SrcVar->getStackOffset()) 938 Dest->getStackOffset() == SrcVar->getStackOffset())
939 return true; 939 return true;
940 return false; 940 return false;
941 } 941 }
942 942
943 } // end of namespace Ice 943 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/cond-br-same-target.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698