1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -passes=ipsccp -S -o - | FileCheck %s
4 ; The original C source looked like this:
6 ; long long a101, b101, e101;
10 ; static inline int bar(p1, p2)
15 ; void foo(unsigned p1)
17 ; long long *f = &b101, *g = &e101;
19 ; (void)((*f |= a101) - (*g = bar(d101)));
20 ; c101 = (*f |= a101 &= p1) == d101;
23 ; When compiled with Clang it gives a warning
24 ; warning: too few arguments in call to 'bar'
26 ; This ll reproducer has been reduced to only include tha call.
28 ; Note that -lint will report this as UB, but it passes -verify.
30 ; This test is just to verify that we do not crash/assert due to mismatch in
31 ; argument count between the caller and callee.
33 define dso_local void @foo(i16 %a) {
34 ; CHECK-LABEL: define {{[^@]+}}@foo
35 ; CHECK-SAME: (i16 [[A:%.*]]) {
36 ; CHECK-NEXT: [[CALL:%.*]] = call i16 @bar(i16 [[A]])
37 ; CHECK-NEXT: ret void
39 %call = call i16 @bar(i16 %a)
43 define internal i16 @bar(i16 %p1, i16 %p2) {
44 ; CHECK-LABEL: define {{[^@]+}}@bar
45 ; CHECK-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]]) {
46 ; CHECK-NEXT: ret i16 0
51 ;-------------------------------------------------------------------------------
52 ; Additional tests to verify that we still optimize when having a mismatch
53 ; in argument count due to varargs (as long as all non-variadic arguments have
56 define internal i16 @vararg_prop(i16 %p1, ...) {
57 ; CHECK-LABEL: define {{[^@]+}}@vararg_prop
58 ; CHECK-SAME: (i16 [[P1:%.*]], ...) {
59 ; CHECK-NEXT: ret i16 undef
64 define dso_local i16 @vararg_tests(i16 %a) {
65 ; CHECK-LABEL: define {{[^@]+}}@vararg_tests
66 ; CHECK-SAME: (i16 [[A:%.*]]) {
67 ; CHECK-NEXT: [[CALL1:%.*]] = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 [[A]])
68 ; CHECK-NEXT: [[CALL2:%.*]] = call i16 @vararg_no_prop(i16 7)
69 ; CHECK-NEXT: [[ADD:%.*]] = add i16 7, [[CALL2]]
70 ; CHECK-NEXT: ret i16 [[ADD]]
72 %call1 = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 %a)
73 %call2 = call i16 @vararg_no_prop (i16 7)
74 %add = add i16 %call1, %call2
78 define internal i16 @vararg_no_prop(i16 %p1, i16 %p2, ...) {
79 ; CHECK-LABEL: define {{[^@]+}}@vararg_no_prop
80 ; CHECK-SAME: (i16 [[P1:%.*]], i16 [[P2:%.*]], ...) {
81 ; CHECK-NEXT: ret i16 [[P1]]