[polly] [llvm] [AST] Don't merge memory locations in AliasSetTracker (PR #65731)

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 15:03:45 PST 2023


================
@@ -0,0 +1,66 @@
+; RUN: opt < %s -passes=aa-eval -evaluate-aa-metadata -aa-pipeline=basic-aa,tbaa -print-all-alias-modref-info -disable-output 2>&1 | FileCheck --check-prefix=CHECKAA %s
+; RUN: opt < %s -S -passes=licm | FileCheck --check-prefix=CHECKLICM %s
+
+; See https://discourse.llvm.org/t/rfc-dont-merge-memory-locations-in-aliassettracker/73336
+; pairwise TBAA indicates NoAlias of load/store ptr at %s with store i32 at %0
+; yet LICM fails to promote load/store ptr %s out of the loop
+
+target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
+
+; CHECKAA-LABEL: Function: _Z4testP1S: 2 pointers, 0 call sites
+; CHECKAA-DAG:  NoAlias:   %0 = load ptr, ptr %s, align 4, !tbaa !7 <->   store i32 %i.05, ptr %0, align 4, !tbaa !12
+; CHECKAA-DAG:  MustAlias:   %0 = load ptr, ptr %s, align 4, !tbaa !7 <->   store ptr %add.ptr.i, ptr %s, align 4, !tbaa !14
+; CHECKAA-DAG:  NoAlias:   store ptr %add.ptr.i, ptr %s, align 4, !tbaa !14 <->   store i32 %i.05, ptr %0, align 4, !tbaa !12
+
+; CHECKLICM-LABEL: define void @_Z4testP1S(ptr noundef %s)
+; CHECKLICM: entry:
+; CHECKLICM: [[P_ENTRY:%[^ ]+]] = load ptr, ptr %s
+; CHECKLICM: for.cond.cleanup:
+; CHECKLICM: [[P_DONE:%[^ ]+]] = phi ptr [ [[P_NEXT:%[^ ]+]], %for.body ]
+; CHECKLICM: store ptr [[P_DONE]], ptr %s
+; CHECKLICM: for.body:
+; CHECKLICM: [[P:%[^ ]+]] = phi ptr [ [[P_ENTRY]], %entry ], [ [[P_NEXT]], %for.body ]
+; CHECKLICM: store i32 {{%[^ ]+}}, ptr [[P]]
+; CHECKLICM: [[P_NEXT]] = getelementptr inbounds i32, ptr [[P]], i32 1
+
+define void @_Z4testP1S(ptr noundef %s) #0 {
----------------
brunodf-snps wrote:

Fixed in commit 7fd5d3cd328d.

https://github.com/llvm/llvm-project/pull/65731


More information about the llvm-commits mailing list