mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
fcfa7c5f92
Summary: The original assumption for the insertDef method was that it would not materialize Defs out of no-where, hence it will not insert phis needed after inserting a Def. However, when cloning an instruction (use case used in LICM), we do materialize Defs "out of no-where". If the block receiving a Def has at least one other Def, then no processing is needed. If the block just received its first Def, we must check where Phi placement is needed. The only new usage of insertDef is in LICM, hence the trigger for the bug. But the original goal of the method also fails to apply for the move() method. If we move a Def from the entry point of a diamond to either the left or right blocks, then the merge block must add a phi. While this usecase does not currently occur, or may be viewed as an incorrect transformation, MSSA must behave corectly given the scenario. Resolves PR40749 and PR40754. Reviewers: george.burgess.iv Subscribers: sanjoy, jlebar, Prazek, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58652 llvm-svn: 355040
55 lines
1.9 KiB
LLVM
55 lines
1.9 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()
|
|
br label %1
|
|
|
|
; <label>:1: ; preds = %.thread, %0
|
|
br label %2
|
|
|
|
; <label>:2: ; preds = %.critedge, %1
|
|
br label %3
|
|
|
|
; <label>:3: ; preds = %5, %2
|
|
%storemerge = phi i32 [ 0, %2 ], [ %6, %5 ]
|
|
store i32 %storemerge, i32* @g_185, align 4
|
|
%4 = icmp ult i32 %storemerge, 2
|
|
br i1 %4, label %5, label %.thread.loopexit
|
|
|
|
; <label>:5: ; preds = %3
|
|
%6 = add i32 %storemerge, 1
|
|
%7 = zext i32 %6 to i64
|
|
%8 = getelementptr [8 x [4 x [6 x i32]]], [8 x [4 x [6 x i32]]]* @g_120, i64 0, i64 undef, i64 %7, i64 undef
|
|
%9 = load i32, i32* %8, align 4
|
|
%10 = icmp eq i32 %9, 0
|
|
br i1 %10, label %3, label %11
|
|
|
|
; <label>:11: ; preds = %5
|
|
%storemerge.lcssa4 = phi i32 [ %storemerge, %5 ]
|
|
%12 = icmp eq i32 %storemerge.lcssa4, 0
|
|
br i1 %12, label %.critedge, label %.thread.loopexit3
|
|
|
|
.critedge: ; preds = %11
|
|
store i16 0, i16* @g_329, align 2
|
|
br label %2
|
|
|
|
.thread.loopexit: ; preds = %3
|
|
br label %.thread
|
|
|
|
.thread.loopexit3: ; preds = %11
|
|
br label %.thread
|
|
|
|
.thread: ; preds = %.thread.loopexit3, %.thread.loopexit
|
|
br label %1
|
|
}
|
|
|