[PATCH] D11143: [RFC] Cross Block DSE

hfinkel at anl.gov hfinkel at anl.gov
Tue Aug 4 08:34:41 PDT 2015


hfinkel added inline comments.

================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:1001
@@ +1000,3 @@
+        uint64_t MemSize = AA->getTypeStoreSize(MemPtr->getType());
+        AliasResult R = AA->alias(Pointer, PtrSize, MemPtr, MemSize);
+        if (R == MustAlias)
----------------
karthikthecool wrote:
> hfinkel wrote:
> > If I'm reading this correctly, this call to AA->alias is going to essentially re-do all of the same analysis done in the AA->getModRefInfo call above. Could we check whether I is a StoreInst first and only to one query on store instructions instead of two?
> > 
> Hi Hal,
> The first check ensures that we see all instructions that may modify/ref a pointer (this is the pointer the store to which we are planning to delete). In case we find an instruction that refers to the pointer e.g. a load we then return false indicating that the store cannot be removed.
> 
> If the instruction is a store we can safely remove the 1st store if and only if both the store and the candidate MustAlias. To detect this i had to check the alias again.
> Thanks and Regards
> Karthik
I understand that the interface here is less than ideal, but could you not skip the getModRefInfo call entirely if `I` is a StoreInst, and just use the result from AA->alias instead? In other words, hoist the dyn_cast<StoreInst>-based check above the ModRef logic?



http://reviews.llvm.org/D11143







More information about the llvm-commits mailing list