102 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 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-unknown-linux-gnu"7 8define i64 @fn2() {9;10; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)11; TUNIT-LABEL: define {{[^@]+}}@fn212; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {13; TUNIT-NEXT: entry:14; TUNIT-NEXT: ret i64 undef15;16; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)17; CGSCC-LABEL: define {{[^@]+}}@fn218; CGSCC-SAME: () #[[ATTR0:[0-9]+]] {19; CGSCC-NEXT: entry:20; CGSCC-NEXT: [[CONV:%.*]] = sext i32 undef to i6421; CGSCC-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]22; CGSCC-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2:[0-9]+]]23; CGSCC-NEXT: ret i64 [[CALL2]]24;25entry:26 %conv = sext i32 undef to i6427 %div = sdiv i64 8, %conv28 %call2 = call i64 @fn1(i64 %div)29 ret i64 %call230}31 32define i64 @fn2b(i32 %arg) {33;34; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)35; TUNIT-LABEL: define {{[^@]+}}@fn2b36; TUNIT-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {37; TUNIT-NEXT: entry:38; TUNIT-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i6439; TUNIT-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]40; TUNIT-NEXT: ret i64 [[DIV]]41;42; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)43; CGSCC-LABEL: define {{[^@]+}}@fn2b44; CGSCC-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {45; CGSCC-NEXT: entry:46; CGSCC-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i6447; CGSCC-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]]48; CGSCC-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2]]49; CGSCC-NEXT: ret i64 [[CALL2]]50;51entry:52 %conv = sext i32 %arg to i6453 %div = sdiv i64 8, %conv54 %call2 = call i64 @fn1(i64 %div)55 ret i64 %call256}57 58define i64 @fn2c() {59; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)60; TUNIT-LABEL: define {{[^@]+}}@fn2c61; TUNIT-SAME: () #[[ATTR0]] {62; TUNIT-NEXT: entry:63; TUNIT-NEXT: ret i64 4264;65; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)66; CGSCC-LABEL: define {{[^@]+}}@fn2c67; CGSCC-SAME: () #[[ATTR0]] {68; CGSCC-NEXT: entry:69; CGSCC-NEXT: [[CONV:%.*]] = sext i32 undef to i6470; CGSCC-NEXT: [[ADD:%.*]] = add i64 42, [[CONV]]71; CGSCC-NEXT: [[CALL2:%.*]] = call range(i64 -2147483606, 2147483690) i64 @fn1(i64 [[ADD]]) #[[ATTR2]]72; CGSCC-NEXT: ret i64 [[CALL2]]73;74entry:75 %conv = sext i32 undef to i6476 %add = add i64 42, %conv77 %call2 = call i64 @fn1(i64 %add)78 ret i64 %call279}80 81define internal i64 @fn1(i64 %p1) {82; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)83; CGSCC-LABEL: define {{[^@]+}}@fn184; CGSCC-SAME: (i64 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {85; CGSCC-NEXT: entry:86; CGSCC-NEXT: ret i64 [[P1]]87;88entry:89 %tobool = icmp ne i64 %p1, 090 %cond = select i1 %tobool, i64 %p1, i64 %p191 ret i64 %cond92}93;.94; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }95;.96; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }97; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }98; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }99;.100;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:101; CHECK: {{.*}}102