Sfoglia il codice sorgente

Fixed bug where MergeGepUse doesn't return true (#4785)

Variable `changed` should be set to true as soon as `MergeGEP` returns a value.
Adam Yang 2 anni fa
parent
commit
f9bc4f598b
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      lib/DXIL/DxilUtilDbgInfoAndMisc.cpp

+ 1 - 1
lib/DXIL/DxilUtilDbgInfoAndMisc.cpp

@@ -137,11 +137,11 @@ bool MergeGepUse(Value *V) {
               dyn_cast<GEPOperator>(GEP->getPointerOperand())) {
               dyn_cast<GEPOperator>(GEP->getPointerOperand())) {
         // merge the 2 GEPs, returns nullptr if couldn't merge
         // merge the 2 GEPs, returns nullptr if couldn't merge
         if (Value *newGEP = MergeGEP(prevGEP, GEP)) {
         if (Value *newGEP = MergeGEP(prevGEP, GEP)) {
+          changed = true;
           worklist.push_back(newGEP);
           worklist.push_back(newGEP);
           // delete prevGEP if no more users
           // delete prevGEP if no more users
           if (prevGEP->user_empty() && isa<GetElementPtrInst>(prevGEP)) {
           if (prevGEP->user_empty() && isa<GetElementPtrInst>(prevGEP)) {
             cast<GetElementPtrInst>(prevGEP)->eraseFromParent();
             cast<GetElementPtrInst>(prevGEP)->eraseFromParent();
-            changed = true;
           }
           }
         }
         }
         else {
         else {