1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=sccp,loop-deletion,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
4 declare double @sqrt(double) readnone nounwind willreturn
6 declare %empty @has_side_effects()
8 ; No matter how hard you try, sqrt(1.0) is always 1.0. This allows the
9 ; optimizer to delete this loop.
10 define double @test_0(i32 %param) {
11 ; CHECK-LABEL: @test_0(
13 ; CHECK-NEXT: ret double 1.000000e+00
17 Loop: ; preds = %Loop, %entry
18 %I2 = phi i32 [ 0, %entry ], [ %I3, %Loop ]
19 %V = phi double [ 1.000000e+00, %entry ], [ %V2, %Loop ]
20 %V2 = call double @sqrt( double %V )
22 %tmp.7 = icmp ne i32 %I3, %param
23 br i1 %tmp.7, label %Loop, label %Exit
28 define i32 @test_1() {
29 ; CHECK-LABEL: @test_1(
30 ; CHECK-NEXT: [[TMP1:%.*]] = call [[EMPTY:%.*]] @has_side_effects()
31 ; CHECK-NEXT: ret i32 0
33 %1 = call %empty @has_side_effects()
37 define i32 @test_not_willreturn() {
38 ; CHECK-LABEL: @test_not_willreturn(
39 ; CHECK-NEXT: [[TMP1:%.*]] = call [[EMPTY:%.*]] @has_side_effects() #[[ATTR1:[0-9]+]]
40 ; CHECK-NEXT: ret i32 0
42 %1 = call %empty @has_side_effects() nounwind readonly