[llvm] 7e496c2 - [tests] Stablize tests for possible change in deref semantics

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 13:37:57 PDT 2021


Author: Philip Reames
Date: 2021-07-14T13:37:50-07:00
New Revision: 7e496c29e2bc85e5b769e0175ca9637dbff5615a

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

LOG: [tests] Stablize tests for possible change in deref semantics

This is conceptually part of e75a2dfe.  This file contains both tests whose results don't change (with the right attributes added), and tests which fundementally regress with the current proposal.  Doing the update took some care, thus the seperate change.

Here's the e75a2dfe context repeated:

There's a potential change in dereferenceability attribute semantics in the nearish future.  See llvm-dev thread "RFC: Decomposing deref(N) into deref(N) + nofree" and D99100 for context.

This change simply adds appropriate attributes to tests to keep transform logic exercised under both old and new/proposed semantics.  Note that for many of these cases, O3 would infer exactly these attributes on the test IR.

This change handles the idiomatic pattern of a dereferenceable object being passed to a call which can not free that memory.  There's a couple other tests which need more one-off attention, they'll be handled in another change.

Added: 
    

Modified: 
    llvm/test/Analysis/BasicAA/dereferenceable.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/BasicAA/dereferenceable.ll b/llvm/test/Analysis/BasicAA/dereferenceable.ll
index 438114d8ac4f5..c50a7d3f59c7a 100644
--- a/llvm/test/Analysis/BasicAA/dereferenceable.ll
+++ b/llvm/test/Analysis/BasicAA/dereferenceable.ll
@@ -4,7 +4,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 @G = global i32 0, align 4
 
-define i64 @global_and_deref_arg_1(i64* dereferenceable(8) %arg) {
+define i64 @global_and_deref_arg_1(i64* dereferenceable(8) %arg) nofree nosync {
 ; CHECK:     Function: global_and_deref_arg_1: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* @G, i64* %arg
 bb:
@@ -14,7 +14,7 @@ bb:
   ret i64 %tmp
 }
 
-define i32 @global_and_deref_arg_2(i32* dereferenceable(8) %arg) {
+define i32 @global_and_deref_arg_2(i32* dereferenceable(8) %arg) nofree nosync {
 ; CHECK:     Function: global_and_deref_arg_2: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* %arg, i32* @G
 bb:
@@ -24,7 +24,7 @@ bb:
   ret i32 %tmp
 }
 
-define i32 @byval_and_deref_arg_1(i32* byval(i32) %obj, i64* dereferenceable(8) %arg) {
+define i32 @byval_and_deref_arg_1(i32* byval(i32) %obj, i64* dereferenceable(8) %arg) nofree nosync {
 ; CHECK:     Function: byval_and_deref_arg_1: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* %obj, i64* %arg
 bb:
@@ -34,7 +34,7 @@ bb:
   ret i32 %tmp
 }
 
-define i32 @byval_and_deref_arg_2(i32* byval(i32) %obj, i32* dereferenceable(8) %arg) {
+define i32 @byval_and_deref_arg_2(i32* byval(i32) %obj, i32* dereferenceable(8) %arg) nofree nosync {
 ; CHECK:     Function: byval_and_deref_arg_2: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* %arg, i32* %obj
 bb:
@@ -77,7 +77,7 @@ bb:
 
 ; Baseline tests, same as above but with 2 instead of 8 dereferenceable bytes.
 
-define i64 @global_and_deref_arg_non_deref_1(i64* dereferenceable(2) %arg) {
+define i64 @global_and_deref_arg_non_deref_1(i64* dereferenceable(2) %arg) nofree nosync {
 ; CHECK:     Function: global_and_deref_arg_non_deref_1: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* @G, i64* %arg
 bb:
@@ -87,7 +87,7 @@ bb:
   ret i64 %tmp
 }
 
-define i32 @global_and_deref_arg_non_deref_2(i32* dereferenceable(2) %arg) {
+define i32 @global_and_deref_arg_non_deref_2(i32* dereferenceable(2) %arg) nofree nosync {
 ; CHECK:     Function: global_and_deref_arg_non_deref_2: 2 pointers, 0 call sites
 ; Different result than above (see @global_and_deref_arg_2).
 ; CHECK-NEXT:  MayAlias:	i32* %arg, i32* @G
@@ -98,7 +98,7 @@ bb:
   ret i32 %tmp
 }
 
-define i32 @byval_and_deref_arg_non_deref_1(i32* byval(i32) %obj, i64* dereferenceable(2) %arg) {
+define i32 @byval_and_deref_arg_non_deref_1(i32* byval(i32) %obj, i64* dereferenceable(2) %arg) nofree nosync {
 ; CHECK:     Function: byval_and_deref_arg_non_deref_1: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* %obj, i64* %arg
 bb:
@@ -108,7 +108,7 @@ bb:
   ret i32 %tmp
 }
 
-define i32 @byval_and_deref_arg_non_deref_2(i32* byval(i32) %obj, i32* dereferenceable(2) %arg) {
+define i32 @byval_and_deref_arg_non_deref_2(i32* byval(i32) %obj, i32* dereferenceable(2) %arg) nofree nosync {
 ; CHECK:     Function: byval_and_deref_arg_non_deref_2: 2 pointers, 0 call sites
 ; CHECK-NEXT:  NoAlias:	i32* %arg, i32* %obj
 bb:


        


More information about the llvm-commits mailing list