llvm.org GIT mirror llvm / 17015f9
[NewGVN] Check for congruency of memory accesses. This is fine as nothing in the code relies on leader and memory leader being the same for a given congruency class. Ack'ed by Dan. Fixes PR33720. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307699 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 93 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
20722072 // be the MemoryAccess of OldClass.
20732073 assert((!InstMA || !OldClass->getMemoryLeader() ||
20742074 OldClass->getLeader() != I ||
2075 OldClass->getMemoryLeader() == InstMA) &&
2075 MemoryAccessToClass.lookup(OldClass->getMemoryLeader()) ==
2076 MemoryAccessToClass.lookup(InstMA)) &&
20762077 "Representative MemoryAccess mismatch");
20772078 // First, see what happens to the new class
20782079 if (!NewClass->getMemoryLeader()) {
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -newgvn -S %s | FileCheck %s
2
3 @f = external local_unnamed_addr global i64
4 @b = external local_unnamed_addr global i64
5 @e = external local_unnamed_addr global i64
6
7 define void @patatino() {
8 ; CHECK-LABEL: @patatino(
9 ; CHECK-NEXT: entry:
10 ; CHECK-NEXT: br i1 undef, label [[IF_END24:%.*]], label [[FOR_COND16:%.*]]
11 ; CHECK: for.cond2thread-pre-split:
12 ; CHECK-NEXT: br i1 false, label [[FOR_BODY:%.*]], label [[FOR_COND8_PREHEADER:%.*]]
13 ; CHECK: for.cond8.preheader:
14 ; CHECK-NEXT: br i1 undef, label [[L1:%.*]], label %for.cond11thread-pre-split.lr.ph
15 ; CHECK: for.cond11thread-pre-split.lr.ph:
16 ; CHECK-NEXT: br label [[L1]]
17 ; CHECK: for.body:
18 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ne i64 [[K_2:%.*]], 3
19 ; CHECK-NEXT: [[CONV4:%.*]] = zext i1 [[CMP3]] to i64
20 ; CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* @f
21 ; CHECK-NEXT: [[OR:%.*]] = or i64 [[TMP0]], [[CONV4]]
22 ; CHECK-NEXT: store i64 [[OR]], i64* @f
23 ; CHECK-NEXT: [[TOBOOL7:%.*]] = icmp ne i64 [[K_2]], 0
24 ; CHECK-NEXT: br i1 [[TOBOOL7]], label %for.cond2thread-pre-split, label [[LOR_RHS:%.*]]
25 ; CHECK: lor.rhs:
26 ; CHECK-NEXT: store i64 1, i64* @b, align 8
27 ; CHECK-NEXT: br label %for.cond2thread-pre-split
28 ; CHECK: l1:
29 ; CHECK-NEXT: [[K_2]] = phi i64 [ undef, [[L1_PREHEADER:%.*]] ], [ 15, [[FOR_COND8_PREHEADER]] ], [ 5, %for.cond11thread-pre-split.lr.ph ]
30 ; CHECK-NEXT: store i64 7, i64* [[J_3:%.*]]
31 ; CHECK-NEXT: br label [[FOR_BODY]]
32 ; CHECK: for.cond16:
33 ; CHECK-NEXT: [[J_0:%.*]] = phi i64* [ @f, [[ENTRY:%.*]] ], [ undef, [[FOR_COND20:%.*]] ], [ @e, [[FOR_COND16]] ]
34 ; CHECK-NEXT: br i1 undef, label [[FOR_COND20]], label [[FOR_COND16]]
35 ; CHECK: for.cond20:
36 ; CHECK-NEXT: [[J_2:%.*]] = phi i64* [ [[J_0]], [[FOR_COND16]] ], [ undef, [[IF_END24]] ]
37 ; CHECK-NEXT: br i1 true, label [[IF_END24]], label [[FOR_COND16]]
38 ; CHECK: if.end24:
39 ; CHECK-NEXT: [[J_3]] = phi i64* [ [[J_2]], [[FOR_COND20]] ], [ undef, [[ENTRY]] ]
40 ; CHECK-NEXT: br i1 false, label [[FOR_COND20]], label [[L1_PREHEADER]]
41 ; CHECK: l1.preheader:
42 ; CHECK-NEXT: br label [[L1]]
43 ;
44 entry:
45 br i1 undef, label %if.end24, label %for.cond16
46
47 for.cond2thread-pre-split:
48 br i1 false, label %for.body, label %for.cond8.preheader
49
50 for.cond8.preheader:
51 br i1 undef, label %l1, label %for.cond11thread-pre-split.lr.ph
52
53 for.cond11thread-pre-split.lr.ph:
54 br label %l1
55
56 for.body:
57 %k.031 = phi i64 [ %k.2, %l1 ], [ 15, %for.cond2thread-pre-split ]
58 %cmp3 = icmp ne i64 %k.031, 3
59 %conv4 = zext i1 %cmp3 to i64
60 %0 = load i64, i64* @f
61 %or = or i64 %0, %conv4
62 store i64 %or, i64* @f
63 %tobool7 = icmp ne i64 %k.031, 0
64 %or.cond = or i1 %tobool7, false
65 br i1 %or.cond, label %for.cond2thread-pre-split, label %lor.rhs
66
67 lor.rhs:
68 store i64 1, i64* @b, align 8
69 br label %for.cond2thread-pre-split
70
71 l1:
72 %k.2 = phi i64 [ undef, %l1.preheader ], [ 15, %for.cond8.preheader ], [ 5, %for.cond11thread-pre-split.lr.ph ]
73 store i64 7, i64* %j.3
74 br label %for.body
75
76 for.cond16:
77 %j.0 = phi i64* [ @f, %entry ], [ %j.2, %for.cond20 ], [ @e, %for.cond16 ]
78 br i1 undef, label %for.cond20, label %for.cond16
79
80 for.cond20:
81 %j.2 = phi i64* [ %j.0, %for.cond16 ], [ %j.3, %if.end24 ]
82 br i1 true, label %if.end24, label %for.cond16
83
84 if.end24:
85 %j.3 = phi i64* [ %j.2, %for.cond20 ], [ undef, %entry ]
86 br i1 false, label %for.cond20, label %l1.preheader
87
88 l1.preheader:
89 br label %l1
90 }