mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
ec066ddf96
Summary: If a block has all incoming values with the same MemoryAccess (ignoring incoming values from unreachable blocks), then use that incoming MemoryAccess and do not create a Phi in the first place. Revert IDF work-around added in rL372673; it should not be required unless the Def inserted is the first in its block. The patch also cleans up a series of tests, added during the many iterations on insertDef. The patch also fixes PR43438. The same issue that occurs in insertDef with "adding phis, hence the IDF of Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive` call only adds Phis walking on the predecessor edges, which means there may be the case of a Phi added walking the CFG "backwards" which triggers the needs for an additional Phi in successor blocks. Such Phis are added during fixupDefs only in the presence of unreachable blocks. Hence this highlights the need to avoid adding Phis in blocks with unreachable predecessors in the first place. Reviewers: george.burgess.iv Subscribers: Prazek, sanjoy.google, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67995 llvm-svn: 372932
56 lines
2.0 KiB
LLVM
56 lines
2.0 KiB
LLVM
; RUN: opt -licm -enable-mssa-loop-dependency -verify-memoryssa -S < %s | FileCheck %s
|
|
; REQUIRES: asserts
|
|
|
|
target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
|
|
target triple = "systemz-unknown"
|
|
|
|
@g_120 = external dso_local local_unnamed_addr global [8 x [4 x [6 x i32]]], align 4
|
|
@g_185 = external dso_local local_unnamed_addr global i32, align 4
|
|
@g_329 = external dso_local local_unnamed_addr global i16, align 2
|
|
|
|
; Function Attrs: norecurse noreturn nounwind
|
|
define dso_local void @func_65() local_unnamed_addr {
|
|
; CHECK-LABEL: @func_65()
|
|
label0:
|
|
br label %label1
|
|
|
|
label1: ; preds = %.thread, %label0
|
|
br label %label2
|
|
|
|
label2: ; preds = %.critedge, %label1
|
|
br label %label3
|
|
|
|
label3: ; preds = %label5, %label2
|
|
%storemerge = phi i32 [ 0, %label2 ], [ %tmp6, %label5 ]
|
|
store i32 %storemerge, i32* @g_185, align 4
|
|
%tmp4 = icmp ult i32 %storemerge, 2
|
|
br i1 %tmp4, label %label5, label %.thread.loopexit
|
|
|
|
label5: ; preds = %label3
|
|
%tmp6 = add i32 %storemerge, 1
|
|
%tmp7 = zext i32 %tmp6 to i64
|
|
%tmp8 = getelementptr [8 x [4 x [6 x i32]]], [8 x [4 x [6 x i32]]]* @g_120, i64 0, i64 undef, i64 %tmp7, i64 undef
|
|
%tmp9 = load i32, i32* %tmp8, align 4
|
|
%tmp10 = icmp eq i32 %tmp9, 0
|
|
br i1 %tmp10, label %label3, label %label11
|
|
|
|
label11: ; preds = %label5
|
|
%storemerge.lcssa4 = phi i32 [ %storemerge, %label5 ]
|
|
%tmp12 = icmp eq i32 %storemerge.lcssa4, 0
|
|
br i1 %tmp12, label %.critedge, label %.thread.loopexit3
|
|
|
|
.critedge: ; preds = %label11
|
|
store i16 0, i16* @g_329, align 2
|
|
br label %label2
|
|
|
|
.thread.loopexit: ; preds = %label3
|
|
br label %.thread
|
|
|
|
.thread.loopexit3: ; preds = %label11
|
|
br label %.thread
|
|
|
|
.thread: ; preds = %.thread.loopexit3, %.thread.loopexit
|
|
br label %label1
|
|
}
|
|
|