Index: llvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll =================================================================== --- llvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll +++ llvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT -; RUN: opt -opaque-pointers=0 -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC ; The original C source looked like this: ; @@ -37,24 +37,28 @@ ; TUNIT: Function Attrs: norecurse ; TUNIT-LABEL: define {{[^@]+}}@foo ; TUNIT-SAME: (i16 [[A:%.*]]) #[[ATTR0:[0-9]+]] { -; TUNIT-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar to i16 (i16)*)(i16 [[A]]) +; TUNIT-NEXT: [[CALL:%.*]] = call i16 @bar(i16 [[A]]) ; TUNIT-NEXT: ret i16 [[CALL]] ; -; CGSCC: Function Attrs: nofree nosync nounwind +; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) ; CGSCC-LABEL: define {{[^@]+}}@foo ; CGSCC-SAME: (i16 [[A:%.*]]) #[[ATTR0:[0-9]+]] { -; CGSCC-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar to i16 (i16)*)(i16 [[A]]) +; CGSCC-NEXT: [[CALL:%.*]] = call noundef i16 @bar() #[[ATTR3:[0-9]+]] ; CGSCC-NEXT: ret i16 [[CALL]] ; - %call = call i16 bitcast (i16 (i16, i16) * @bar to i16 (i16) *)(i16 %a) + %call = call i16 @bar(i16 %a) ret i16 %call } define internal i16 @bar(i16 %p1, i16 %p2) { -; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) -; CHECK-LABEL: define {{[^@]+}}@bar -; CHECK-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) #[[ATTR1:[0-9]+]] { -; CHECK-NEXT: ret i16 0 +; TUNIT-LABEL: define {{[^@]+}}@bar +; TUNIT-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) { +; TUNIT-NEXT: ret i16 0 +; +; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) +; CGSCC-LABEL: define {{[^@]+}}@bar +; CGSCC-SAME: () #[[ATTR1:[0-9]+]] { +; CGSCC-NEXT: ret i16 0 ; ret i16 0 } @@ -63,25 +67,30 @@ ; TUNIT: Function Attrs: norecurse ; TUNIT-LABEL: define {{[^@]+}}@foo2 ; TUNIT-SAME: (i16 [[A:%.*]]) #[[ATTR0]] { -; TUNIT-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar2 to i16 (i16)*)(i16 [[A]]) +; TUNIT-NEXT: [[CALL:%.*]] = call i16 @bar2(i16 [[A]]) ; TUNIT-NEXT: ret i16 [[CALL]] ; -; CGSCC: Function Attrs: nofree nosync nounwind +; CGSCC: Function Attrs: nofree nosync nounwind memory(none) ; CGSCC-LABEL: define {{[^@]+}}@foo2 -; CGSCC-SAME: (i16 [[A:%.*]]) #[[ATTR0]] { -; CGSCC-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar2 to i16 (i16)*)(i16 [[A]]) +; CGSCC-SAME: (i16 [[A:%.*]]) #[[ATTR2:[0-9]+]] { +; CGSCC-NEXT: [[CALL:%.*]] = call i16 @bar2(i16 [[A]]) ; CGSCC-NEXT: ret i16 [[CALL]] ; - %call = call i16 bitcast (i16 (i16, i16) * @bar2 to i16 (i16) *)(i16 %a) + %call = call i16 @bar2(i16 %a) ret i16 %call } define internal i16 @bar2(i16 %p1, i16 %p2) { -; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) -; CHECK-LABEL: define {{[^@]+}}@bar2 -; CHECK-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) #[[ATTR1]] { -; CHECK-NEXT: [[A:%.*]] = add i16 [[P1]], [[P2]] -; CHECK-NEXT: ret i16 [[A]] +; TUNIT-LABEL: define {{[^@]+}}@bar2 +; TUNIT-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) { +; TUNIT-NEXT: [[A:%.*]] = add i16 [[P1]], [[P2]] +; TUNIT-NEXT: ret i16 [[A]] +; +; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) +; CGSCC-LABEL: define {{[^@]+}}@bar2 +; CGSCC-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) #[[ATTR1]] { +; CGSCC-NEXT: [[A:%.*]] = add i16 [[P1]], [[P2]] +; CGSCC-NEXT: ret i16 [[A]] ; %a = add i16 %p1, %p2 ret i16 %a @@ -97,20 +106,20 @@ ; TUNIT: Function Attrs: norecurse ; TUNIT-LABEL: define {{[^@]+}}@vararg_tests ; TUNIT-SAME: (i16 [[A:%.*]]) #[[ATTR0]] { -; TUNIT-NEXT: [[CALL2:%.*]] = call i16 bitcast (i16 (i16, i16, ...)* @vararg_no_prop to i16 (i16)*)(i16 noundef 7) +; TUNIT-NEXT: [[CALL2:%.*]] = call i16 @vararg_no_prop(i16 7) ; TUNIT-NEXT: [[ADD:%.*]] = add i16 7, [[CALL2]] ; TUNIT-NEXT: ret i16 [[ADD]] ; -; CGSCC: Function Attrs: nofree nosync nounwind +; CGSCC: Function Attrs: nofree nosync nounwind memory(none) ; CGSCC-LABEL: define {{[^@]+}}@vararg_tests -; CGSCC-SAME: (i16 [[A:%.*]]) #[[ATTR0]] { -; CGSCC-NEXT: [[CALL1:%.*]] = call i16 (i16, ...) @vararg_prop(i16 noundef 7, i16 noundef 8, i16 [[A]]) #[[ATTR2:[0-9]+]] -; CGSCC-NEXT: [[CALL2:%.*]] = call i16 bitcast (i16 (i16, i16, ...)* @vararg_no_prop to i16 (i16)*)(i16 7) +; CGSCC-SAME: (i16 [[A:%.*]]) #[[ATTR2]] { +; CGSCC-NEXT: [[CALL1:%.*]] = call i16 (i16, ...) @vararg_prop(i16 noundef 7, i16 noundef 8, i16 [[A]]) #[[ATTR3]] +; CGSCC-NEXT: [[CALL2:%.*]] = call i16 @vararg_no_prop(i16 7) ; CGSCC-NEXT: [[ADD:%.*]] = add i16 [[CALL1]], [[CALL2]] ; CGSCC-NEXT: ret i16 [[ADD]] ; %call1 = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 %a) - %call2 = call i16 bitcast (i16 (i16, i16, ...) * @vararg_no_prop to i16 (i16) *) (i16 7) + %call2 = call i16 @vararg_no_prop (i16 7) %add = add i16 %call1, %call2 ret i16 %add } @@ -125,19 +134,25 @@ } define internal i16 @vararg_no_prop(i16 %p1, i16 %p2, ...) { -; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) -; CHECK-LABEL: define {{[^@]+}}@vararg_no_prop -; CHECK-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]], ...) #[[ATTR1]] { -; CHECK-NEXT: ret i16 7 +; TUNIT-LABEL: define {{[^@]+}}@vararg_no_prop +; TUNIT-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]], ...) { +; TUNIT-NEXT: ret i16 [[P1]] +; +; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) +; CGSCC-LABEL: define {{[^@]+}}@vararg_no_prop +; CGSCC-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]], ...) #[[ATTR1]] { +; CGSCC-NEXT: ret i16 7 ; ret i16 %p1 } ;. ; TUNIT: attributes #[[ATTR0]] = { norecurse } -; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } ;. -; CGSCC: attributes #[[ATTR0]] = { nofree nosync nounwind } +; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) } ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } -; CGSCC: attributes #[[ATTR2]] = { willreturn } +; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind memory(none) } +; CGSCC: attributes #[[ATTR3]] = { willreturn } ;. +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}}