48 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=sccp -S | FileCheck %s3 4; Test that SCCP has basic knowledge of when and/or/mul nuke overdefined values.5 6 define i32 @test(i32 %X) {7; CHECK-LABEL: @test(8; CHECK-NEXT: ret i32 09;10 %Y = and i32 %X, 011 ret i32 %Y12}13 14define i32 @test2(i32 %X) {15; CHECK-LABEL: @test2(16; CHECK-NEXT: ret i32 -117;18 %Y = or i32 -1, %X19 ret i32 %Y20}21 22define i32 @test3(i32 %X) {23; CHECK-LABEL: @test3(24; CHECK-NEXT: [[Y:%.*]] = and i32 undef, [[X:%.*]]25; CHECK-NEXT: ret i32 [[Y]]26;27 %Y = and i32 undef, %X28 ret i32 %Y29}30 31define i32 @test4(i32 %X) {32; CHECK-LABEL: @test4(33; CHECK-NEXT: [[Y:%.*]] = or i32 [[X:%.*]], undef34; CHECK-NEXT: ret i32 [[Y]]35;36 %Y = or i32 %X, undef37 ret i32 %Y38}39 40; X * 0 = 0 even if X is overdefined.41define i32 @test5(i32 %foo) {42; CHECK-LABEL: @test5(43; CHECK-NEXT: ret i32 044;45 %patatino = mul i32 %foo, 046 ret i32 %patatino47}48