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