brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 50c8bd5 Raw
102 lines · plain
1; REQUIRES: asserts2; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=ASM3; RUN: llc -debug -o /dev/null < %s -mtriple=x86_64-- 2>&1 | FileCheck %s --check-prefix=DBG4; rdar://81689385 6; This testcase involves SCEV normalization with the exit value from7; one loop involved with the increment value for an addrec on another8; loop. The expression should be properly normalized and simplified,9; and require only a single division.10 11; DBG-NOT: DISCARDING (NORMALIZATION ISN'T INVERTIBLE)12; ASM: div13; ASM-NOT: div14 15%0 = type { ptr, ptr }16 17@0 = private constant [13 x i8] c"Result: %lu\0A\00" ; <ptr> [#uses=1]18@1 = internal constant [5 x i8] c"Huh?\00"        ; <ptr> [#uses=1]19 20define i32 @main(i32 %arg, ptr nocapture %arg1) nounwind {21bb:22  %tmp = alloca %0, align 8                       ; <ptr> [#uses=11]23  call void @llvm.memset.p0.i64(ptr align 8 %tmp, i8 0, i64 16, i1 false) nounwind24  %tmp3 = getelementptr inbounds %0, ptr %tmp, i64 0, i32 0 ; <ptr> [#uses=3]25  store ptr %tmp, ptr %tmp326  %tmp4 = getelementptr inbounds %0, ptr %tmp, i64 0, i32 1 ; <ptr> [#uses=1]27  store ptr %tmp, ptr %tmp428  %tmp5 = call noalias ptr @_Znwm(i64 24) nounwind ; <ptr> [#uses=2]29  %tmp6 = getelementptr inbounds i8, ptr %tmp5, i64 16 ; <ptr> [#uses=2]30  %tmp7 = icmp eq ptr %tmp6, null                 ; <i1> [#uses=1]31  br i1 %tmp7, label %bb10, label %bb832 33bb8:                                              ; preds = %bb34  store i32 1, ptr %tmp635  br label %bb1036 37bb10:                                             ; preds = %bb8, %bb38  call void @_ZNSt15_List_node_base4hookEPS_(ptr %tmp5, ptr %tmp) nounwind39  %tmp12 = load ptr, ptr %tmp3                        ; <ptr> [#uses=3]40  %tmp13 = icmp eq ptr %tmp12, %tmp               ; <i1> [#uses=1]41  br i1 %tmp13, label %bb14, label %bb1642 43bb14:                                             ; preds = %bb1044  %tmp15 = call i32 @puts(ptr @1)45  br label %bb3546 47bb16:                                             ; preds = %bb16, %bb1048  %tmp17 = phi i64 [ %tmp22, %bb16 ], [ 0, %bb10 ] ; <i64> [#uses=1]49  %tmp18 = phi ptr [ %tmp20, %bb16 ], [ %tmp12, %bb10 ] ; <ptr> [#uses=1]50  %tmp19 = getelementptr inbounds %0, ptr %tmp18, i64 0, i32 0 ; <ptr> [#uses=1]51  %tmp20 = load ptr, ptr %tmp19                       ; <ptr> [#uses=2]52  %tmp21 = icmp eq ptr %tmp20, %tmp               ; <i1> [#uses=1]53  %tmp22 = add i64 %tmp17, 1                      ; <i64> [#uses=2]54  br i1 %tmp21, label %bb23, label %bb1655 56bb23:                                             ; preds = %bb1657  %tmp24 = udiv i64 100, %tmp22                   ; <i64> [#uses=1]58  br label %bb2559 60bb25:                                             ; preds = %bb25, %bb2361  %tmp26 = phi i64 [ %tmp31, %bb25 ], [ 0, %bb23 ] ; <i64> [#uses=1]62  %tmp27 = phi ptr [ %tmp29, %bb25 ], [ %tmp12, %bb23 ] ; <ptr> [#uses=1]63  %tmp28 = getelementptr inbounds %0, ptr %tmp27, i64 0, i32 0 ; <ptr> [#uses=1]64  %tmp29 = load ptr, ptr %tmp28                       ; <ptr> [#uses=2]65  %tmp30 = icmp eq ptr %tmp29, %tmp               ; <i1> [#uses=1]66  %tmp31 = add i64 %tmp26, 1                      ; <i64> [#uses=2]67  br i1 %tmp30, label %bb32, label %bb2568 69bb32:                                             ; preds = %bb2570  %tmp33 = mul i64 %tmp31, %tmp24                 ; <i64> [#uses=1]71  %tmp34 = call i32 (ptr, ...) @printf(ptr @0, i64 %tmp33) nounwind72  br label %bb3573 74bb35:                                             ; preds = %bb32, %bb1475  %tmp36 = load ptr, ptr %tmp3                        ; <ptr> [#uses=2]76  %tmp37 = icmp eq ptr %tmp36, %tmp               ; <i1> [#uses=1]77  br i1 %tmp37, label %bb44, label %bb3878 79bb38:                                             ; preds = %bb38, %bb3580  %tmp39 = phi ptr [ %tmp41, %bb38 ], [ %tmp36, %bb35 ] ; <ptr> [#uses=2]81  %tmp40 = getelementptr inbounds %0, ptr %tmp39, i64 0, i32 0 ; <ptr> [#uses=1]82  %tmp41 = load ptr, ptr %tmp40                       ; <ptr> [#uses=2]83  call void @_ZdlPv(ptr %tmp39) nounwind84  %tmp43 = icmp eq ptr %tmp41, %tmp               ; <i1> [#uses=1]85  br i1 %tmp43, label %bb44, label %bb3886 87bb44:                                             ; preds = %bb38, %bb3588  ret i32 089}90 91declare i32 @printf(ptr nocapture, ...) nounwind92 93declare void @_ZNSt15_List_node_base4hookEPS_(ptr, ptr)94 95declare noalias ptr @_Znwm(i64)96 97declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind98 99declare void @_ZdlPv(ptr) nounwind100 101declare i32 @puts(ptr nocapture) nounwind102