brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · b224b5e Raw
97 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4; PR55695 6; IPSCCP should prove that the blocks are dead and delete them, and7; properly handle the dangling blockaddress constants.8 9@code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 4 ; <ptr> [#uses=0]10@bar.l = internal constant [2 x ptr] [ptr blockaddress(@bar, %lab0), ptr blockaddress(@bar, %end)] ; <ptr> [#uses=1]11 12;.13; TUNIT: @code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 414; TUNIT: @bar.l = internal constant [2 x ptr] [ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr)]15;.16; CGSCC: @code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 417; CGSCC: @bar.l = internal constant [2 x ptr] [ptr blockaddress(@bar, %lab0), ptr blockaddress(@bar, %end)]18;.19define internal void @foo(i32 %x) nounwind readnone {20; CGSCC: Function Attrs: nounwind memory(none)21; CGSCC-LABEL: define {{[^@]+}}@foo22; CGSCC-SAME: (i32 [[X:%.*]]) #[[ATTR0:[0-9]+]] {23; CGSCC-NEXT:  entry:24; CGSCC-NEXT:    [[B:%.*]] = alloca i32, align 425; CGSCC-NEXT:    store volatile i32 -1, ptr [[B]], align 426; CGSCC-NEXT:    ret void27;28entry:29  %b = alloca i32, align 4                        ; <ptr> [#uses=1]30  store volatile i32 -1, ptr %b31  ret void32}33 34define internal void @bar(ptr nocapture %pc) nounwind readonly {35; CGSCC: Function Attrs: nounwind memory(read)36; CGSCC-LABEL: define {{[^@]+}}@bar37; CGSCC-SAME: (ptr captures(none) [[PC:%.*]]) #[[ATTR1:[0-9]+]] {38; CGSCC-NEXT:  entry:39; CGSCC-NEXT:    br label [[INDIRECTGOTO:%.*]]40; CGSCC:       lab0:41; CGSCC-NEXT:    [[INDVAR_NEXT:%.*]] = add i32 [[INDVAR:%.*]], 142; CGSCC-NEXT:    br label [[INDIRECTGOTO]]43; CGSCC:       end:44; CGSCC-NEXT:    ret void45; CGSCC:       indirectgoto:46; CGSCC-NEXT:    [[INDVAR]] = phi i32 [ [[INDVAR_NEXT]], [[LAB0:%.*]] ], [ 0, [[ENTRY:%.*]] ]47; CGSCC-NEXT:    [[PC_ADDR_0:%.*]] = getelementptr i32, ptr [[PC]], i32 [[INDVAR]]48; CGSCC-NEXT:    [[TMP1_PN:%.*]] = load i32, ptr [[PC_ADDR_0]], align 449; CGSCC-NEXT:    [[INDIRECT_GOTO_DEST_IN:%.*]] = getelementptr inbounds [2 x ptr], ptr @bar.l, i32 0, i32 [[TMP1_PN]]50; CGSCC-NEXT:    [[INDIRECT_GOTO_DEST:%.*]] = load ptr, ptr [[INDIRECT_GOTO_DEST_IN]], align 851; CGSCC-NEXT:    indirectbr ptr [[INDIRECT_GOTO_DEST]], [label [[LAB0]], label %end]52;53entry:54  br label %indirectgoto55 56lab0:                                             ; preds = %indirectgoto57  %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]58  br label %indirectgoto59 60end:                                              ; preds = %indirectgoto61  ret void62 63indirectgoto:                                     ; preds = %lab0, %entry64  %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2]65  %pc.addr.0 = getelementptr i32, ptr %pc, i32 %indvar ; <ptr> [#uses=1]66  %tmp1.pn = load i32, ptr %pc.addr.0                 ; <i32> [#uses=1]67  %indirect.goto.dest.in = getelementptr inbounds [2 x ptr], ptr @bar.l, i32 0, i32 %tmp1.pn ; <ptr> [#uses=1]68  %indirect.goto.dest = load ptr, ptr %indirect.goto.dest.in ; <ptr> [#uses=1]69  indirectbr ptr %indirect.goto.dest, [label %lab0, label %end]70}71 72define i32 @main() nounwind readnone {73; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)74; TUNIT-LABEL: define {{[^@]+}}@main75; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {76; TUNIT-NEXT:  entry:77; TUNIT-NEXT:    ret i32 078;79; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)80; CGSCC-LABEL: define {{[^@]+}}@main81; CGSCC-SAME: () #[[ATTR2:[0-9]+]] {82; CGSCC-NEXT:  entry:83; CGSCC-NEXT:    ret i32 084;85entry:86  ret i32 087}88;.89; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }90;.91; CGSCC: attributes #[[ATTR0]] = { nounwind memory(none) }92; CGSCC: attributes #[[ATTR1]] = { nounwind memory(read) }93; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }94;.95;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:96; CHECK: {{.*}}97