brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · ed50709 Raw
45 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=sccp,loop-deletion,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s3 4declare double @sqrt(double) readnone nounwind willreturn5%empty = type {}6declare %empty @has_side_effects()7 8; No matter how hard you try, sqrt(1.0) is always 1.0.  This allows the9; optimizer to delete this loop.10define double @test_0(i32 %param) {11; CHECK-LABEL: @test_0(12; CHECK-NEXT:  entry:13; CHECK-NEXT:    ret double 1.000000e+0014;15entry:16  br label %Loop17Loop:		; preds = %Loop, %entry18  %I2 = phi i32 [ 0, %entry ], [ %I3, %Loop ]19  %V = phi double [ 1.000000e+00, %entry ], [ %V2, %Loop ]20  %V2 = call double @sqrt( double %V )21  %I3 = add i32 %I2, 122  %tmp.7 = icmp ne i32 %I3, %param23  br i1 %tmp.7, label %Loop, label %Exit24Exit:		; preds = %Loop25  ret double %V26}27 28define i32 @test_1() {29; CHECK-LABEL: @test_1(30; CHECK-NEXT:    [[TMP1:%.*]] = call [[EMPTY:%.*]] @has_side_effects()31; CHECK-NEXT:    ret i32 032;33  %1 = call %empty @has_side_effects()34  ret i32 035}36 37define 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 041;42  %1 = call %empty @has_side_effects() nounwind readonly43  ret i32 044}45