-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Clang][BasicAA][AIE2] Enable full PHI AA for AIE #103
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
; | ||
; This file is licensed under the Apache License v2.0 with LLVM Exceptions. | ||
; See https://llvm.org/LICENSE.txt for license information. | ||
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
; | ||
; (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates | ||
; | ||
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -basic-aa-full-phi-analysis \ | ||
; RUN: -disable-output 2>&1 | FileCheck %s --check-prefix=FULL-PHI | ||
|
||
@X = common global i32 0 | ||
@Y = common global i32 0 | ||
|
||
; The goal of this set of tests is to test the differences in the behavior of | ||
; the BasicAA with and without full phi analysis in a dual diamond scenario. | ||
|
||
|
||
; Test 1: The basic shape of the test is the following (simp. without phis): | ||
|
||
; if (...) { | ||
; if (...) { | ||
; %P = getelementptr @X ... | ||
; } else { | ||
; %P = getelementptr @X ... | ||
; } | ||
; } else { | ||
; %P = getelementptr @X ... | ||
; } | ||
gbossu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
; | ||
; // Use of %P and @Y | ||
; | ||
|
||
; CHECK: MayAlias: i32* %P, i32* @Y | ||
; FULL-PHI: NoAlias: i32* %P, i32* @Y | ||
define void @test1(i32 %cond) nounwind { | ||
entry: | ||
%"alloca point" = bitcast i32 0 to i32 | ||
%tmp = icmp ne i32 %cond, 0 | ||
br i1 %tmp, label %bbtrue, label %bbfalse | ||
|
||
bbtrue: | ||
%tmp1 = icmp ne i32 %cond, 2 | ||
br i1 %tmp, label %bbtruetrue, label %bbtruefalse | ||
|
||
bbtruetrue: | ||
%p1 = getelementptr i32, ptr @X, i64 0 | ||
br label %bbtrueend | ||
|
||
bbtruefalse: | ||
%p2 = getelementptr i32, ptr @X, i64 0 | ||
br label %bbtrueend | ||
|
||
bbtrueend: | ||
%p3 = phi ptr [ %p1, %bbtruetrue ], [ %p2, %bbtruefalse ] | ||
br label %bblast | ||
|
||
bbfalse: | ||
%p4 = getelementptr i32, ptr @X, i64 0 | ||
br label %bblast | ||
|
||
bblast: | ||
%P = phi ptr [ %p3, %bbtrueend ], [ %p4, %bbfalse ] | ||
%tmp2 = load i32, ptr @Y, align 4 | ||
store i32 123, ptr %P, align 4 | ||
%tmp3 = load i32, ptr @Y, align 4 | ||
br label %return | ||
|
||
return: | ||
ret void | ||
} | ||
|
||
|
||
; Test 2: The basic shape of the test is the following (simp. without phis): | ||
|
||
; if (...) { | ||
; if (...) { | ||
; %P = getelementptr @Y ... (cause of MayAlias) | ||
; } else { | ||
; %P = getelementptr @X ... | ||
; } | ||
; } else { | ||
; %P = getelementptr @X ... | ||
; } | ||
; | ||
; // Use of %P and @Y | ||
; | ||
|
||
; CHECK: MayAlias: i32* %P, i32* @Y | ||
; FULL-PHI: MayAlias: i32* %P, i32* @Y | ||
define void @test2(i32 %cond) nounwind { | ||
entry: | ||
%"alloca point" = bitcast i32 0 to i32 | ||
%tmp = icmp ne i32 %cond, 0 | ||
br i1 %tmp, label %bbtrue, label %bbfalse | ||
|
||
bbtrue: | ||
%tmp1 = icmp ne i32 %cond, 2 | ||
br i1 %tmp, label %bbtruetrue, label %bbtruefalse | ||
|
||
bbtruetrue: | ||
%p1 = getelementptr i32, ptr @Y, i64 0 | ||
br label %bbtrueend | ||
|
||
bbtruefalse: | ||
%p2 = getelementptr i32, ptr @X, i64 0 | ||
br label %bbtrueend | ||
|
||
bbtrueend: | ||
%p3 = phi ptr [ %p1, %bbtruetrue ], [ %p2, %bbtruefalse ] | ||
br label %bblast | ||
|
||
bbfalse: | ||
%p4 = getelementptr i32, ptr @X, i64 0 | ||
br label %bblast | ||
|
||
bblast: | ||
%P = phi ptr [ %p3, %bbtrueend ], [ %p4, %bbfalse ] | ||
%tmp2 = load i32, ptr @Y, align 4 | ||
store i32 123, ptr %P, align 4 | ||
%tmp3 = load i32, ptr @Y, align 4 | ||
br label %return | ||
|
||
return: | ||
ret void | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we (ie in the average AIE application) wouldn't really notice it if we make it 20, (or 50?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By looking to the statistics I saw this limit being exhausted for one benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So 20 would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @martien-de-jong, I believe that 10 is enough for now, considering our benchmarks that are quite complex.