[DivRemPairs] Strip division's poison generating flag
authorJuneyoung Lee <aqjune@gmail.com>
Sat, 18 Feb 2023 20:43:26 +0000 (20:43 +0000)
committerJuneyoung Lee <aqjune@gmail.com>
Sat, 18 Feb 2023 21:00:55 +0000 (21:00 +0000)
commit2ad0cc9186d4952b3009e1b8c3c606f0b13ea38a
tree0fc4054b102312931964a3e5c292f907b0a0912d
parentc726b34ea01b74741dd9a6ae072e5ca4d9a3e623
[DivRemPairs] Strip division's poison generating flag

Given this transformation: X % Y -> X - (X / Y) * Y

This patch strips off the poison-generating flag of X / Y such as exact, because it may make the optimized form result poison whereas X % Y does not.

The issue was reported here: https://github.com/llvm/llvm-project/issues/60748

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D144333
llvm/lib/Transforms/Scalar/DivRemPairs.cpp
llvm/test/Transforms/DivRemPairs/AArch64/div-rem-pairs.ll