Home | History | Annotate | Download | only in SCCP
      1 ; RUN: opt < %s -sccp -S | FileCheck %s
      2 
      3 ; Test that SCCP has basic knowledge of when and/or/mul nuke overdefined values.
      4 
      5 ; CHECK-LABEL: test
      6 ; CHECK: ret i32 0
      7  define i32 @test(i32 %X) {
      8   %Y = and i32 %X, 0
      9   ret i32 %Y
     10 }
     11 
     12 ; CHECK-LABEL: test2
     13 ; CHECK: ret i32 -1
     14 define i32 @test2(i32 %X) {
     15   %Y = or i32 -1, %X
     16   ret i32 %Y
     17 }
     18 
     19 ; CHECK-LABEL: test3
     20 ; CHECK: ret i32 0
     21 define i32 @test3(i32 %X) {
     22   %Y = and i32 undef, %X
     23   ret i32 %Y
     24 }
     25 
     26 ; CHECK-LABEL: test4
     27 ; CHECK: ret i32 -1
     28 define i32 @test4(i32 %X) {
     29   %Y = or i32 %X, undef
     30   ret i32 %Y
     31 }
     32 
     33 ; X * 0 = 0 even if X is overdefined.
     34 ; CHECK-LABEL: test5
     35 ; CHECK: ret i32 0
     36 define i32 @test5(i32 %foo) {
     37   %patatino = mul i32 %foo, 0
     38   ret i32 %patatino
     39 }
     40