[PATCH] D154953: [InstSimplify] Remove the remainder loop if we know the mask is always true

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 04:02:07 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:83
+                                               Value *LHS, Value *RHS,
+                                               const SimplifyQuery &Q);
 
----------------
Unnecessary change.


================
Comment at: llvm/test/Transforms/InstCombine/rem-mul-shl.ll:887
   ret i64 %rem
 }
 
----------------
Please also add tests that are directly in the add -1 form (as that's what is actually being folded).

We should also test the case where the constant operand is not a power of two, as it is a pre-condition of your transform. (Actually, we don't really need a power of two, it would be sufficient if it does not have any bits that may be part of the mask set. But it's a requirement for your current implementation.)


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

https://reviews.llvm.org/D154953



More information about the llvm-commits mailing list