[PATCH] D136015: [InstCombine] Fold series of instructions into mull

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 18:56:53 PDT 2022


Allen added a subscriber: tgt.
Allen added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/mul_full_64.ll:452
 
 define i64 @mullo(i64 %x, i64 %y) {
 ; CHECK-LABEL: @mullo(
----------------
spatel wrote:
> chfast wrote:
> > Interestingly, it hasn't folded this one.
> This patch assumes we are ending with an "add", but this test changes to an "or". We'd need to add another check for hasNoCommonBitsSet() to catch it?
> 
> Here's another potential fold:
> https://alive2.llvm.org/ce/z/hUm56R
> ...but it needs to freeze the inputs to be poison-safe because they have multiple uses.
hi @chfast
   I think the case **@mullo** should not be matched? https://alive2.llvm.org/ce/z/jH4kU7

hi, @spatel
   As the case in link https://alive2.llvm.org/ce/z/hUm56R, it's result not equal to **mul i8 %y, %x**, so it need some other logic to match ? maybe defined with a new helper function. see detail https://alive2.llvm.org/ce/z/FEgEU7
  ```
define i8 @tgt(i8 %x, i8 %y) {
  %m = mul i8 %y, %x
  ret i8 %m
}
  ```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136015



More information about the llvm-commits mailing list