[all-commits] [llvm/llvm-project] 1fae4b: [InstCombine] Fold mul nuw+lshr to a single multip...

chenglin.bi via All-commits all-commits at lists.llvm.org
Wed Apr 20 09:15:19 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fae4b492dd1fcb46473e7bf8f6e82356d187a09
  Author: chenglin.bi <chenglin.bi at cixcomputing.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
    M llvm/test/Transforms/InstCombine/shift-logic.ll

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

if c is divisible by (1 << ShAmtC), we can fold this pattern:
lshr (mul nuw x, c), ShAmtC -> mul nuw x, (c >> ShAmtC)


Fix https://github.com/llvm/llvm-project/issues/54824

Reviewed By: spatel, lebedev.ri, craig.topper

Differential Revision: https://reviews.llvm.org/D123453

More information about the All-commits mailing list