[all-commits] [llvm/llvm-project] 34c89e: [InstCombine] Fold `trunc nuw/nsw (x xor y) to i1`...
Monad via All-commits
all-commits at lists.llvm.org
Tue Apr 30 03:08:02 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 34c89eff64cce7debb8e2d5a0d1c4d896a23e432
https://github.com/llvm/llvm-project/commit/34c89eff64cce7debb8e2d5a0d1c4d896a23e432
Author: Monad <yanwqmonad at gmail.com>
Date: 2024-04-30 (Tue, 30 Apr 2024)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
M llvm/test/Transforms/InstCombine/trunc.ll
Log Message:
-----------
[InstCombine] Fold `trunc nuw/nsw (x xor y) to i1` to `x != y` (#90408)
Fold:
``` llvm
define i1 @src(i8 %x, i8 %y) {
%xor = xor i8 %x, %y
%r = trunc nuw/nsw i8 %xor to i1
ret i1 %r
}
define i1 @tgt(i8 %x, i8 %y) {
%r = icmp ne i8 %x, %y
ret i1 %r
}
```
Proof: https://alive2.llvm.org/ce/z/dcuHmn
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list