diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -329,7 +329,8 @@ OW_End, OW_PartialEarlierWithFullLater, OW_MaybePartial, - OW_Unknown + OW_Unknown, + OW_None }; } // end anonymous namespace @@ -1006,8 +1007,11 @@ // If we can't resolve the same pointers to the same object, then we can't // analyze them at all. - if (DeadUndObj != KillingUndObj) + if (DeadUndObj != KillingUndObj) { + if (AAR == AliasResult::NoAlias) + return OW_None; return OW_Unknown; + } // If the KillingI store is to a recognizable object, get its size. uint64_t KillingUndObjSize = getPointerSize(KillingUndObj, DL, TLI, &F); @@ -1063,7 +1067,7 @@ // Can reach here only if accesses are known not to overlap. There is no // dedicated code to indicate no overlap so signal "unknown". - return OW_Unknown; + return OW_None; } bool isInvisibleToCallerAfterRet(const Value *V) { @@ -1462,7 +1466,7 @@ KillingOffset, DeadOffset); // If Current does not write to the same object as KillingDef, check // the next candidate. - if (OR == OW_Unknown) + if (OR == OW_Unknown || OR == OW_None) continue; else if (OR == OW_MaybePartial) { // If KillingDef only partially overwrites Current, check the next