[PATCH] D36841: [SimplifyCFG] Fix for PR34219: Preserve alignment after merging conditional stores.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 13:33:09 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2972
+  if (unsigned Alignment = PStore->getAlignment())
+    SI->setAlignment(Alignment);
 
----------------
ABataev wrote:
> efriedma wrote:
> > ABataev wrote:
> > > efriedma wrote:
> > > > What happens if PStore and QStore have different alignment?
> > > Generally speaking, they must be the same.
> > I don't see any code to ensure they are the same.  (Or do you mean we shouldn't do this transform if the alignment is different?)
> Actually, PStore and QStore work with the same values, so they must have the same alignment because it is the same operations. We just merge them into the single one. I'm not sure, if they may have the different alignments. If they may have the different alignments, we can choose the one that is greater.
I think you have to take the smaller of the two alignments?  Even if the pointer value is the same "Value*", it could have different alignment along different codepaths.


https://reviews.llvm.org/D36841





More information about the llvm-commits mailing list