1 ; If we have an 'and' of the result of an 'or', and one of the 'or' operands
2 ; cannot have contributed any of the resultant bits, delete the or. This
3 ; occurs for very common C/C++ code like this:
5 ; struct foo { int A : 16; int B : 16; };
6 ; void test(struct foo *F, int X, int Y) {
10 ; Which corresponds to test1.
12 ; This tests arbitrary precision integers.
14 ; RUN: opt < %s -instcombine -S | not grep "or "
17 define i17 @test1(i17 %X, i17 %Y) {
21 %D = and i17 %C, 7 ;; This cannot include any bits from %Y!
25 define i49 @test3(i49 %X, i49 %Y) {
28 %D = and i49 %C, 1 ;; This cannot include any bits from %Y!
32 define i67 @test4(i67 %X, i67 %Y) {
35 %D = and i67 %C, 2 ;; This cannot include any bits from %Y!
39 define i231 @or_test1(i231 %X, i231 %Y) {
41 %B = or i231 %A, 1 ;; This cannot include any bits from X!
45 define i7 @or_test2(i7 %X, i7 %Y) {
47 %B = or i7 %A, 64 ;; This cannot include any bits from X!