[llvm] dab7d51 - [Attributor][NFC] Add more simple test situations for callbacks

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 21:53:39 PST 2019


Author: Johannes Doerfert
Date: 2019-12-13T23:51:59-06:00
New Revision: dab7d515bac92f244230912aa8490aa17e41df4a

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

LOG: [Attributor][NFC] Add more simple test situations for callbacks

Added: 
    

Modified: 
    llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll b/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
index 567455f4fd54..9e8012138af1 100644
--- a/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
+++ b/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
@@ -24,18 +24,29 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 @GlobalVPtr = common dso_local global i8* null, align 8
 
+; FIXME: nocapture & noalias for @GlobalVPtr in %call1
+; FIXME: nocapture & noalias for %alloc2 in %call3
+
 define dso_local i32 @main() {
 ; CHECK-LABEL: define {{[^@]+}}@main()
 ; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[ALLOC1:%.*]] = alloca i8, align 8
+; CHECK-NEXT:    [[ALLOC2:%.*]] = alloca i8, align 8
 ; CHECK-NEXT:    [[THREAD:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:    [[CALL:%.*]] = call i32 @pthread_create(i64* nonnull [[THREAD]], %union.pthread_attr_t* null, i8* (i8*)* nonnull @foo, i8* noalias null)
 ; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @pthread_create(i64* nonnull [[THREAD]], %union.pthread_attr_t* null, i8* (i8*)* nonnull @bar, i8* nonnull align 8 dereferenceable(8) bitcast (i8** @GlobalVPtr to i8*))
+; CHECK-NEXT:    [[CALL2:%.*]] = call i32 @pthread_create(i64* nonnull [[THREAD]], %union.pthread_attr_t* null, i8* (i8*)* nonnull @baz, i8* noalias nocapture nonnull align 8 dereferenceable(1) [[ALLOC1]])
+; CHECK-NEXT:    [[CALL3:%.*]] = call i32 @pthread_create(i64* nonnull [[THREAD]], %union.pthread_attr_t* null, i8* (i8*)* nonnull @buz, i8* nonnull align 8 dereferenceable(1) [[ALLOC2]])
 ; CHECK-NEXT:    ret i32 0
 ;
 entry:
+  %alloc1 = alloca i8, align 8
+  %alloc2 = alloca i8, align 8
   %thread = alloca i64, align 8
   %call = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @foo, i8* null)
   %call1 = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @bar, i8* bitcast (i8** @GlobalVPtr to i8*))
+  %call2 = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @baz, i8* nocapture %alloc1)
+  %call3 = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @buz, i8* %alloc2)
   ret i32 0
 }
 
@@ -61,5 +72,25 @@ entry:
   ret i8* %arg
 }
 
+define internal i8* @baz(i8* %arg) {
+; CHECK-LABEL: define {{[^@]+}}@baz
+; CHECK-SAME: (i8* noalias nofree nonnull readnone returned align 8 dereferenceable(1) [[ARG:%.*]])
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    ret i8* [[ARG:%.*]]
+;
+entry:
+  ret i8* %arg
+}
+
+define internal i8* @buz(i8* %arg) {
+; CHECK-LABEL: define {{[^@]+}}@buz
+; CHECK-SAME: (i8* nofree nonnull readnone returned align 8 dereferenceable(1) [[ARG:%.*]])
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    ret i8* [[ARG:%.*]]
+;
+entry:
+  ret i8* %arg
+}
+
 !1 = !{i64 2, i64 3, i1 false}
 !0 = !{!1}


        


More information about the llvm-commits mailing list