1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=sccp -S | FileCheck %s
4 ; Test that SCCP has basic knowledge of when and/or/mul nuke overdefined values.
6 define i32 @test(i32 %X) {
8 ; CHECK-NEXT: ret i32 0
14 define i32 @test2(i32 %X) {
15 ; CHECK-LABEL: @test2(
16 ; CHECK-NEXT: ret i32 -1
22 define i32 @test3(i32 %X) {
23 ; CHECK-LABEL: @test3(
24 ; CHECK-NEXT: [[Y:%.*]] = and i32 undef, [[X:%.*]]
25 ; CHECK-NEXT: ret i32 [[Y]]
27 %Y = and i32 undef, %X
31 define i32 @test4(i32 %X) {
32 ; CHECK-LABEL: @test4(
33 ; CHECK-NEXT: [[Y:%.*]] = or i32 [[X:%.*]], undef
34 ; CHECK-NEXT: ret i32 [[Y]]
40 ; X * 0 = 0 even if X is overdefined.
41 define i32 @test5(i32 %foo) {
42 ; CHECK-LABEL: @test5(
43 ; CHECK-NEXT: ret i32 0
45 %patatino = mul i32 %foo, 0