[llvm-dev] [SCEV] Mul/UDiv folding (original) (raw)
Alexandre Isoard via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 6 07:44:10 PDT 2017
- Previous message: [llvm-dev] RISC-V LLVM status update
- Next message: [llvm-dev] [SCEV] Mul/UDiv folding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
I was looking into the expression folding strategies of SCEV and found out that we don't fold multiplication and divisions:
define void @test12(i32) { entry: %1 = udiv i32 %0, 123 %2 = mul i32 %1, 123 %3 = udiv i32 %2, 123 %4 = mul i32 %3, 123 ret void }
Will give:
%4 = mul i32 %3, 123 --> (123 * ((123 * (%0 /u 123)) /u 123)) U: [0,-36) S: [0,-36)
Is there a specific reason for that, or can I add a folding rule?
Maybe the problem is that division can round off some lsb, and multiplication can wrap around some msb, and therefore we can't easily simplify those. But even adding "exact" on udiv and "nuw nsw" on mul does not help.
Best regard.
-- Alexandre Isoard -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170906/596858d0/attachment.html>
- Previous message: [llvm-dev] RISC-V LLVM status update
- Next message: [llvm-dev] [SCEV] Mul/UDiv folding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]