1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
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) {
35 ; CHECK-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar to i16 (i16)*)(i16 [[A:%.*]])
36 ; CHECK-NEXT: ret void
38 %call = call i16 bitcast (i16 (i16, i16) * @bar to i16 (i16) *)(i16 %a)
42 define internal i16 @bar(i16 %p1, i16 %p2) {
44 ; CHECK-NEXT: ret i16 0
49 ;-------------------------------------------------------------------------------
50 ; Additional tests to verify that we still optimize when having a mismatch
51 ; in argument count due to varargs (as long as all non-variadic arguments have
54 define internal i16 @vararg_prop(i16 %p1, ...) {
55 ; CHECK-LABEL: @vararg_prop(
56 ; CHECK-NEXT: ret i16 undef
61 define dso_local i16 @vararg_tests(i16 %a) {
62 ; CHECK-LABEL: @vararg_tests(
63 ; CHECK-NEXT: [[CALL1:%.*]] = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 [[A:%.*]])
64 ; CHECK-NEXT: [[CALL2:%.*]] = call i16 bitcast (i16 (i16, i16, ...)* @vararg_no_prop to i16 (i16)*)(i16 7)
65 ; CHECK-NEXT: [[ADD:%.*]] = add i16 7, [[CALL2]]
66 ; CHECK-NEXT: ret i16 [[ADD]]
68 %call1 = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 %a)
69 %call2 = call i16 bitcast (i16 (i16, i16, ...) * @vararg_no_prop to i16 (i16) *) (i16 7)
70 %add = add i16 %call1, %call2
74 define internal i16 @vararg_no_prop(i16 %p1, i16 %p2, ...) {
75 ; CHECK-LABEL: @vararg_no_prop(
76 ; CHECK-NEXT: ret i16 [[P1:%.*]]