mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-27 10:18:36 +00:00
6720ed851b
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
36 lines
1.2 KiB
LLVM
36 lines
1.2 KiB
LLVM
; RUN: opt -disable-output -licm -print-memoryssa -enable-mssa-loop-dependency=true < %s 2>&1 | FileCheck %s
|
|
@v_274 = external dso_local global i64, align 1
|
|
@v_295 = external dso_local global i16, align 1
|
|
@v_335 = external dso_local global i32, align 1
|
|
|
|
; CHECK-LABEL: @main()
|
|
; CHECK-NOT: 5 = MemoryPhi(
|
|
; CHECK-NOT: 6 = MemoryPhi(
|
|
; CHECK: 4 = MemoryPhi(
|
|
; CHECK-NOT: 7 = MemoryPhi(
|
|
define dso_local void @main() {
|
|
entry:
|
|
store i32 undef, i32* @v_335, align 1
|
|
br i1 undef, label %gate, label %exit
|
|
|
|
nopredentry1: ; No predecessors!
|
|
br label %preinfiniteloop
|
|
|
|
nopredentry2: ; No predecessors!
|
|
br label %gate
|
|
|
|
gate: ; preds = %nopredentry2, %entry
|
|
br i1 undef, label %preinfiniteloop, label %exit
|
|
|
|
preinfiniteloop: ; preds = %gate, %nopredentry1
|
|
br label %infiniteloop
|
|
|
|
infiniteloop: ; preds = %infiniteloop, %preinfiniteloop
|
|
store i16 undef, i16* @v_295, align 1
|
|
br label %infiniteloop
|
|
|
|
exit: ; preds = %gate, %entry
|
|
store i64 undef, i64* @v_274, align 1
|
|
ret void
|
|
}
|