[PATCH] D123453: [InstCombine] Fold mul nuw+lshr to a single multiplication when the latter is a factor

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 08:46:10 PDT 2022


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

LGTM - see inline remark for minor edit to a code comment.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:1177
+
+      // Check one-use here to make sure we can save the shift instruction,
+      // avoid replace shift to mul as shift is cheaper than mul in general.
----------------
I would phrase this differently:
  // The one-use check is not strictly necessary, but codegen may not be able 
  // to invert the transform and perf may suffer with an extra mul instruction.


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

https://reviews.llvm.org/D123453



More information about the llvm-commits mailing list