| 267 | } |
| 268 | |
| 269 | bool LoopFusion::CheckCondition() { |
| 270 | auto condition_0 = loop_0_->GetConditionInst(); |
| 271 | auto condition_1 = loop_1_->GetConditionInst(); |
| 272 | |
| 273 | if (!loop_0_->IsSupportedCondition(condition_0->opcode()) || |
| 274 | !loop_1_->IsSupportedCondition(condition_1->opcode())) { |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | if (condition_0->opcode() != condition_1->opcode()) { |
| 279 | return false; |
| 280 | } |
| 281 | |
| 282 | for (uint32_t i = 0; i < condition_0->NumInOperandWords(); ++i) { |
| 283 | auto arg_0 = context_->get_def_use_mgr()->GetDef( |
| 284 | condition_0->GetSingleWordInOperand(i)); |
| 285 | auto arg_1 = context_->get_def_use_mgr()->GetDef( |
| 286 | condition_1->GetSingleWordInOperand(i)); |
| 287 | |
| 288 | if (arg_0 == induction_0_ && arg_1 == induction_1_) { |
| 289 | continue; |
| 290 | } |
| 291 | |
| 292 | if (arg_0 == induction_0_ && arg_1 != induction_1_) { |
| 293 | return false; |
| 294 | } |
| 295 | |
| 296 | if (arg_1 == induction_1_ && arg_0 != induction_0_) { |
| 297 | return false; |
| 298 | } |
| 299 | |
| 300 | if (arg_0 != arg_1) { |
| 301 | return false; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | return true; |
| 306 | } |
| 307 | |
| 308 | bool LoopFusion::CheckStep() { |
| 309 | auto scalar_analysis = context_->GetScalarEvolutionAnalysis(); |
nothing calls this directly
no test coverage detected