[llvm] 2555ed5 - [InstCombine] Add callee bitcast test with byval on callee (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 01:55:21 PST 2022


Author: Nikita Popov
Date: 2022-03-03T10:55:14+01:00
New Revision: 2555ed55a434b731c03f9b6286e93f4637e7d58d

URL: https://github.com/llvm/llvm-project/commit/2555ed55a434b731c03f9b6286e93f4637e7d58d
DIFF: https://github.com/llvm/llvm-project/commit/2555ed55a434b731c03f9b6286e93f4637e7d58d.diff

LOG: [InstCombine] Add callee bitcast test with byval on callee (NFC)

Same as the existing test, but the callee also has a byval
attribute.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/byval.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/byval.ll b/llvm/test/Transforms/InstCombine/byval.ll
index fa6b2bc2f80a0..b7459ef1fdf0e 100644
--- a/llvm/test/Transforms/InstCombine/byval.ll
+++ b/llvm/test/Transforms/InstCombine/byval.ll
@@ -1,21 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -S -passes=instcombine %s | FileCheck %s
 
 declare void @add_byval_callee(double*)
 
-; CHECK-LABEL: define void @add_byval
-; CHECK: [[ARG:%.*]] = bitcast i64* %in to double*
-; CHECK: call void @add_byval_callee(double* byval(double) [[ARG]])
+declare void @add_byval_callee_2(double* byval(double))
+
 define void @add_byval(i64* %in) {
+; CHECK-LABEL: @add_byval(
+; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i64* [[IN:%.*]] to double*
+; CHECK-NEXT:    call void @add_byval_callee(double* byval(double) [[TMP1]])
+; CHECK-NEXT:    ret void
+;
   %tmp = bitcast void (double*)* @add_byval_callee to void (i64*)*
   call void %tmp(i64* byval(i64) %in)
   ret void
 }
 
+define void @add_byval_2(i64* %in) {
+; CHECK-LABEL: @add_byval_2(
+; CHECK-NEXT:    call void bitcast (void (double*)* @add_byval_callee_2 to void (i64*)*)(i64* byval(i64) [[IN:%.*]])
+; CHECK-NEXT:    ret void
+;
+  %tmp = bitcast void (double*)* @add_byval_callee_2 to void (i64*)*
+  call void %tmp(i64* byval(i64) %in)
+  ret void
+}
+
 %t2 = type { i8 }
 
-; CHECK-LABEL: define void @vararg_byval
-; CHECK: call void (i8, ...) @vararg_callee(i8 undef, i8* byval(i8) %p)
 define void @vararg_byval(i8* %p) {
+; CHECK-LABEL: @vararg_byval(
+; CHECK-NEXT:    call void (i8, ...) @vararg_callee(i8 undef, i8* byval(i8) [[P:%.*]])
+; CHECK-NEXT:    ret void
+;
   %tmp = bitcast i8* %p to %t2*
   call void (i8, ...) @vararg_callee(i8 undef, %t2* byval(%t2) %tmp)
   ret void


        


More information about the llvm-commits mailing list