-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sometimes PHI nodes form a cyclic dependency, which uses some values but not used anywhere. Such cycles are not removed by DCE and, what is much worse, often prevent used instructions from being bailed
- Loading branch information
Showing
4 changed files
with
78 additions
and
17 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
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,41 @@ | ||
;=========================== begin_copyright_notice ============================ | ||
; | ||
; Copyright (C) 2023 Intel Corporation | ||
; | ||
; SPDX-License-Identifier: MIT | ||
; | ||
;============================ end_copyright_notice ============================= | ||
; | ||
; RUN: opt %use_old_pass_manager% -GenXPatternMatch -march=genx64 -mcpu=Gen9 -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s | ||
; CHECK-NOT: %bad1 = phi i32 [ undef, %entry ], [ %bad2, %loop.end ] | ||
; CHECK-NOT: %bad2 = phi i32 [ %bad1, %true ], [ %mul, %false ] | ||
|
||
define i32 @test(i32 %a, i32 %n) { | ||
entry: | ||
br label %loop | ||
|
||
loop: | ||
%bad1 = phi i32 [ undef, %entry ], [ %bad2, %loop.end ] | ||
%res = phi i32 [ 0, %entry ], [ %res.next, %loop.end ] | ||
%i = phi i32 [ 0, %entry ], [ %i.next, %loop.end ] | ||
%if.cond = icmp slt i32 %i, 10 | ||
br i1 %if.cond, label %true, label %false | ||
|
||
true: | ||
%add = add i32 %res, %a | ||
br label %loop.end | ||
|
||
false: | ||
%mul = mul i32 %res, %a | ||
br label %loop.end | ||
|
||
loop.end: | ||
%bad2 = phi i32 [ %bad1, %true ], [ %mul, %false ] | ||
%res.next = phi i32 [ %add, %true ], [ %mul, %false ] | ||
%i.next = add i32 %i, 1 | ||
%loop.cond = icmp slt i32 %i.next, %n | ||
br i1 %loop.cond, label %loop, label %exit | ||
|
||
exit: | ||
ret i32 %res.next | ||
} |