[PATCH] D11143: [RFC] Cross Block DSE
Karthik Bhat
kv.bhat at samsung.com
Tue Aug 4 01:53:49 PDT 2015
karthikthecool added a comment.
Hi Hal,
Thanks for looking into the patch. Please find my comments inline.
Regards
Karthik Bhat
================
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)
----------------
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
http://reviews.llvm.org/D11143
More information about the llvm-commits
mailing list