llvm.org GIT mirror llvm / 1895810
[MemorySSA +LICM CFHoist] Solve PR40317. Summary: MemorySSA needs updating each time an instruction is moved. LICM and control flow hoisting re-hoists instructions, thus needing another update when re-moving those instructions. Pending cleanup: the MSSA update is duplicated, should be moved inside moveInstructionBefore. Reviewers: jnspaulsson Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits Differential Revision: https://reviews.llvm.org/D57176 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352092 91177308-0d34-0410-b5e6-96231b3b80d8 Alina Sbirlea 7 months ago
2 changed file(s) with 67 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
866866 << HoistPoint->getParent()->getName()
867867 << ": " << *I << "\n");
868868 moveInstructionBefore(*I, *HoistPoint, *SafetyInfo);
869 if (MSSAU)
870 if (MemoryUseOrDef *OldMemAcc = cast_or_null(
871 MSSAU->getMemorySSA()->getMemoryAccess(I)))
872 MSSAU->moveToPlace(OldMemAcc, HoistPoint->getParent(),
873 MemorySSA::End);
869874 HoistPoint = I;
870875 Changed = true;
871876 }
0 ; RUN: opt -S -march=z13 -tbaa -licm -enable-mssa-loop-dependency -licm-control-flow-hoisting -verify-memoryssa < %s | FileCheck %s
1
2 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
3 target triple = "s390x-ibm-linux"
4
5 %0 = type { %1, %1, i16, %2 }
6 %1 = type <{ i16, i8, i32, i32, i32, i64, i64 }>
7 %2 = type { i8, i16, i16, [2 x i8] }
8
9 @0 = internal global %0 { %1 <{ i16 22437, i8 117, i32 2017322857, i32 900074563, i32 -1390364, i64 0, i64 0 }>, %1 <{ i16 0, i8 7, i32 -387299562, i32 925371866, i32 -1, i64 4826244575317081679, i64 1 }>, i16 8, %2 { i8 0, i16 0, i16 3, [2 x i8] undef } }, align 2
10 @g_18 = external dso_local global i64, align 8
11
12 ; Function Attrs: argmemonly nounwind
13 declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1
14
15 ; CHECK-LABEL: @func_94
16 ; CHECK: bb:
17 ; CHECK: tail call void @llvm.memset.p0i8.i64
18 ; CHECK: load i32
19 ; CHECK: bb6.licm:
20 ; Function Attrs: noreturn nounwind
21 define dso_local void @func_94(i16 %arg, i64* nocapture %arg1) local_unnamed_addr #3 {
22 bb:
23 tail call void @llvm.memset.p0i8.i64(i8* align 8 undef, i8 0, i64 80, i1 false)
24 br label %bb3
25
26 bb3: ; preds = %bb13, %bb
27 %tmp5 = icmp eq i16 %arg, 0
28 br i1 %tmp5, label %bb6, label %bb13
29
30 bb6: ; preds = %bb3
31 %tmp7 = load i32, i32* getelementptr inbounds (%0, %0* @0, i64 0, i32 1, i32 2), align 1, !tbaa !11
32 %tmp8 = zext i32 %tmp7 to i64
33 %sext = shl i64 %tmp8, 56
34 %tmp10 = ashr exact i64 %sext, 56
35 store i64 %tmp10, i64* %arg1, align 8, !tbaa !12
36 br label %bb13
37
38 bb13: ; preds = %bb3, %bb6
39 br label %bb3
40 }
41
42 attributes #0 = { "use-soft-float"="false" }
43 attributes #1 = { argmemonly nounwind }
44 attributes #2 = { norecurse nounwind readnone "use-soft-float"="false" }
45 attributes #3 = { noreturn nounwind "use-soft-float"="false" }
46
47 !llvm.ident = !{!0}
48
49 !0 = !{!"clang version 8.0.0 (http://llvm.org/git/clang.git e593a791f2cf19db84237b0b9d632e9966a00a39) (http://llvm.org/git/llvm.git fe0523d1bd7def3ef62cfb3dd37a8b1941aafa81)"}
50 !1 = !{!2, !8, i64 46}
51 !2 = !{!"S5", !3, i64 0, !3, i64 31, !4, i64 62, !9, i64 64}
52 !3 = !{!"S2", !4, i64 0, !5, i64 2, !7, i64 3, !7, i64 7, !7, i64 11, !8, i64 15, !8, i64 23}
53 !4 = !{!"short", !5, i64 0}
54 !5 = !{!"omnipotent char", !6, i64 0}
55 !6 = !{!"Simple C/C++ TBAA"}
56 !7 = !{!"int", !5, i64 0}
57 !8 = !{!"long", !5, i64 0}
58 !9 = !{!"S3", !7, i64 0, !4, i64 2, !4, i64 4}
59 !10 = !{!2, !7, i64 42}
60 !11 = !{!2, !7, i64 34}
61 !12 = !{!8, !8, i64 0}