[PATCH] D42871: [InstCombine] Simplify MemTransferInst's source and dest alignments separately
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 12:44:25 PST 2018
efriedma added inline comments.
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:245
+ SrcAlign = std::max(SrcAlign, CopySrcAlign);
+ DstAlign = std::max(DstAlign, CopyDstAlign);
> efriedma wrote:
> > Aren't SrcAlign and CopySrcAlign always the same?
> I'm guessing that the original code was there because it's possible for there to be a greater alignment value on the memory intrinsic than getKnownAlignment() would give us. I'm not really sure how that would happen.... I suppose that it's possible that now that the alignment on the memory intrinsic isn't just the min of the two arg alignments that these lines are now redundant.
> I'm not really sure how that would happen....
In the old world, SrcAlign could be larger than CopyAlign if the dest has low/unknown alignment. And CopyAlign could be larger than SrcAlign if the frontend or some other pass computed better alignment than getKnownAlignment.
In the new world, CopySrcAlign is always greater than or equal to SrcAlign; you explicitly check it a few lines earlier.
More information about the llvm-commits