[PATCH] D134323: AtomicExpand: Avoid some operations if the atomic is overaligned

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 16:07:50 PDT 2022


rampitec accepted this revision.
rampitec added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:726
 
-  PMV.ShiftAmt = Builder.CreateTrunc(PMV.ShiftAmt, PMV.WordType, "ShiftAmt");
   PMV.Mask = Builder.CreateShl(
       ConstantInt::get(PMV.WordType, (1 << (ValueSize * 8)) - 1), PMV.ShiftAmt,
----------------
arsenm wrote:
> rampitec wrote:
> > Should this also go under if? Looks like for an overaligned case it is a no-op. I can actually see shl by 0 in the produced IR.
> Yes, but this was less effort than writing separate code to handle the mask shifting
Oh, I see. It is cleaned up by the D134324.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134323/new/

https://reviews.llvm.org/D134323



More information about the llvm-commits mailing list