[PATCH] D22305: [BasicAA] Strip phi nodes, when all incoming values are the same.

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 17:55:19 PDT 2016


amehsan added a comment.

@dberlin

I see two concerns in your comment:

> > Why not fix GVN to do that?

> 

> 

> 


Before GVN this phi node has two different incoming values. At some point A in GVN, one of the incoming values change and we get the phi node in the example above. At some point B in the GVN, the phi node is removed. Somewhere between A and B, GVN makes an alias analysis query. So I think there is not really a problem in GVN to fix.

> > IE if we next discover cases where all the phi arguments are redundant

> 

> >  bitcasts of the same value, do we add that?

> 

> >  What about more complex operations?

> 

> 

> 


I think eventually, this code should be part of stripPointerCasts that we call in lines 1403-1404. There we handle pointers that are hidden behind bitcasts and GEPs where indices are zero.


http://reviews.llvm.org/D22305





More information about the llvm-commits mailing list