[llvm] [DAGCombiner] Don't drop atomic property of original load. (PR #75626)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 13:14:54 PST 2023


topperc wrote:

> > getAlign() combines the base alignment of the MMO with the MMO offset. This can cause the base alignment of the newly created MMO to become smaller than the original MMO. This can produce different results if the MMO is later split into multiple MMOs with different offsets.
> 
> 
> 
> I don't quite follow how this could go wrong as folding the bitcast doesn't change the memory access in any way. Shouldn't the later splitting also take into account the original offset?
> 
> 

I may have explained that badly. The code should have used getOriginalAlign to begin with. Not the first case of this I've seen.

Using getAlign probably decreased the alignment based on the trailing zeros of the current offset. A later split probably gave a new offset that had more trailing zeros. By using original align we are able to infer a larger alignment for this new offset. With getAlign it's been overly reduced so the new offset can't increase it.

This patch has the same effect as using getOriginalAlign.

https://github.com/llvm/llvm-project/pull/75626


More information about the llvm-commits mailing list