Browse Source

Replace uses of phi which has same operand for all path with the operand. (#115)

Xiang Li 8 years ago
parent
commit
d5dbc051f3
1 changed files with 4 additions and 2 deletions
  1. 4 2
      lib/HLSL/DxilGenerationPass.cpp

+ 4 - 2
lib/HLSL/DxilGenerationPass.cpp

@@ -1916,10 +1916,12 @@ void DxilGenerationPass::AddCreateHandleForPhiNode(std::unordered_map<Instructio
     }
 
     if (resClass0) {
-      handlePhi->setArgOperand(DXIL::OperandIndex::kCreateHandleResClassOpIdx, resClass0);
+      resClassPhi->replaceAllUsesWith(resClass0);
+      resClassPhi->eraseFromParent();
     }
     if (resID0) {
-      handlePhi->setArgOperand(DXIL::OperandIndex::kCreateHandleResIDOpIdx, resID0);
+      resIDPhi->replaceAllUsesWith(resID0);
+      resIDPhi->eraseFromParent();
     }
   }