-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIE2] Implement TTI hook to disable GEP to PHI folding
- Loading branch information
1 parent
3752021
commit ef131e8
Showing
2 changed files
with
56 additions
and
0 deletions.
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
47 changes: 47 additions & 0 deletions
47
llvm/test/CodeGen/AIE/aie2/aie2-prevent-gep-phi-folding.ll
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,47 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; | ||
; 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 -mtriple=aie2 -passes=instcombine -S < %s | FileCheck %s | ||
|
||
%struct = type { i32, i32 } | ||
|
||
define i32 @dontFoldGEPs(ptr %dm, i1 %arg4, i64 %arg9, i64 %arg19) { | ||
; CHECK-LABEL: define i32 @dontFoldGEPs( | ||
; CHECK-SAME: ptr [[DM:%.*]], i1 [[ARG4:%.*]], i64 [[ARG9:%.*]], i64 [[ARG19:%.*]]) { | ||
; CHECK-NEXT: bb: | ||
; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DM]], align 8 | ||
; CHECK-NEXT: br i1 [[ARG4]], label [[BB1:%.*]], label [[BB2:%.*]] | ||
; CHECK: bb1: | ||
; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[ARG9]] to i20 | ||
; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT2:%.*]], ptr [[TMP1]], i20 [[TMP0]] | ||
; CHECK-NEXT: br label [[BB3:%.*]] | ||
; CHECK: bb2: | ||
; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[ARG19]] to i20 | ||
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT2]], ptr [[TMP1]], i20 [[TMP2]] | ||
; CHECK-NEXT: br label [[BB3]] | ||
; CHECK: bb3: | ||
; CHECK-NEXT: [[PHI:%.*]] = phi ptr [ [[TMP10]], [[BB1]] ], [ [[TMP4]], [[BB2]] ] | ||
; CHECK-NEXT: [[TMP25:%.*]] = load i32, ptr [[PHI]], align 4 | ||
; CHECK-NEXT: ret i32 [[TMP25]] | ||
; | ||
bb: | ||
%0 = load ptr, ptr %dm, align 8 | ||
br i1 %arg4, label %bb1, label %bb2 | ||
|
||
bb1: | ||
%1 = getelementptr inbounds %struct, ptr %0, i64 %arg9 | ||
br label %bb3 | ||
|
||
bb2: | ||
%2 = getelementptr inbounds %struct, ptr %0, i64 %arg19 | ||
br label %bb3 | ||
|
||
bb3: | ||
%phi = phi ptr [ %1, %bb1 ], [ %2, %bb2 ] | ||
%3 = load i32, ptr %phi, align 4 | ||
ret i32 %3 | ||
} |