[InstCombine] fold abs(srem X, 2)
authorSanjay Patel <spatel@rotateright.com>
Wed, 31 Mar 2021 15:26:22 +0000 (11:26 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 31 Mar 2021 15:29:20 +0000 (11:29 -0400)
commit1462bdf1b985256fb52ddccdbbe8fbf5a9ad48b5
treea25057c742f758fb8b781ae1bf5966da2ca5e393
parent07a6d07c482706268caa9c4f9e3a13d71f9c7fb9
[InstCombine] fold abs(srem X, 2)

This is a missing optimization based on an example in:
https://llvm.org/PR49763

As noted there and the test here, we could add a more
general fold if that is shown useful.

https://alive2.llvm.org/ce/z/xEHdTv
https://alive2.llvm.org/ce/z/97dcY5
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/abs-intrinsic.ll