[llvm] r302905 - [NewGVN] Don't incorrectly reset the memory leader.
Kaylor, Andrew via llvm-commits
llvm-commits at lists.llvm.org
Fri May 12 17:06:13 PDT 2017
Hi Davide,
Is there any chance that the test you added here is flaky? I don't see any obvious reason it would be, but I got a few buildbot failures checking in a set of changes that have nothing to do with this (r302955-302957) and at least one of the bots has turned green again since then without any changes to fix it.
-Andy
-----Original Message-----
From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of Davide Italiano via llvm-commits
Sent: Friday, May 12, 2017 8:23 AM
To: llvm-commits at lists.llvm.org
Subject: [llvm] r302905 - [NewGVN] Don't incorrectly reset the memory leader.
Author: davide
Date: Fri May 12 10:22:45 2017
New Revision: 302905
URL: http://llvm.org/viewvc/llvm-project?rev=302905&view=rev
Log:
[NewGVN] Don't incorrectly reset the memory leader.
This code was missing a check for stores, so we were thinking the congruency class didn't have any memory members, and reset the memory leader.
Differential Revision: https://reviews.llvm.org/D33056
Added:
llvm/trunk/test/Transforms/NewGVN/pr32934.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=302905&r1=302904&r2=302905&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Fri May 12 10:22:45 2017
@@ -1409,7 +1409,7 @@ bool NewGVN::setMemoryClass(const Memory
NewClass->memory_insert(MP);
// This may have killed the class if it had no non-memory members
if (OldClass->getMemoryLeader() == From) {
- if (OldClass->memory_empty()) {
+ if (OldClass->definesNoMemory()) {
OldClass->setMemoryLeader(nullptr);
} else {
OldClass->setMemoryLeader(getNextMemoryLeader(OldClass));
Added: llvm/trunk/test/Transforms/NewGVN/pr32934.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/NewGVN/pr32934.ll?rev=302905&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/NewGVN/pr32934.ll (added)
+++ llvm/trunk/test/Transforms/NewGVN/pr32934.ll Fri May 12 10:22:45
+++ 2017
@@ -0,0 +1,68 @@
+; RUN: opt -S -newgvn %s | FileCheck %s
+
+; CHECK: define void @tinkywinky() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: %d = alloca i32, align 4
+; CHECK-NEXT: store i32 0, i32* null, align 4
+; CHECK-NEXT: br label %for.cond
+; CHECK: for.cond: ; preds = %if.end, %entry
+; CHECK-NEXT: %0 = load i32, i32* null, align 4
+; CHECK-NEXT: %cmp = icmp slt i32 %0, 1
+; CHECK-NEXT: br i1 %cmp, label %for.body, label %while.cond
+; CHECK: for.body: ; preds = %for.cond
+; CHECK-NEXT: %1 = load i32, i32* @a, align 4
+; CHECK-NEXT: store i32 %1, i32* %d, align 4
+; CHECK-NEXT: br label %L
+; CHECK: L: ; preds = %if.then, %for.body
+; CHECK-NEXT: %tobool = icmp ne i32 %1, 0
+; CHECK-NEXT: br i1 %tobool, label %if.then, label %if.end
+; CHECK: if.then: ; preds = %L
+; CHECK-NEXT: call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
+; CHECK-NEXT: br label %L
+; CHECK: if.end: ; preds = %L
+; CHECK-NEXT: br label %for.cond
+; CHECK: while.cond: ; preds = %while.body, %for.cond
+; CHECK-NEXT: br i1 undef, label %while.body, label %while.end
+; CHECK: while.body: ; preds = %while.cond
+; CHECK-NEXT: call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
+; CHECK-NEXT: br label %while.cond
+; CHECK: while.end:
+; CHECK-NEXT: %2 = load i32, i32* @a, align 4
+; CHECK-NEXT: store i32 %2, i32* undef, align 4
+; CHECK-NEXT: ret void
+
+ at a = external global i32, align 4
+ at patatino = external unnamed_addr constant [2 x i8], align 1 define
+void @tinkywinky() {
+entry:
+ %d = alloca i32, align 4
+ store i32 0, i32* null, align 4
+ br label %for.cond
+for.cond:
+ %0 = load i32, i32* null, align 4
+ %cmp = icmp slt i32 %0, 1
+ br i1 %cmp, label %for.body, label %while.cond
+for.body:
+ %1 = load i32, i32* @a, align 4
+ store i32 %1, i32* %d, align 4
+ br label %L
+L:
+ %2 = load i32, i32* %d, align 4
+ %tobool = icmp ne i32 %2, 0
+ br i1 %tobool, label %if.then, label %if.end
+if.then:
+ call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2
+x i8]* @patatino, i32 0, i32 0))
+ br label %L
+if.end:
+ br label %for.cond
+while.cond:
+ br i1 undef, label %while.body, label %while.end
+while.body:
+ call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2
+x i8]* @patatino, i32 0, i32 0))
+ br label %while.cond
+while.end:
+ %3 = load i32, i32* @a, align 4
+ store i32 %3, i32* undef, align 4
+ ret void
+}
+declare void @printf(i8*, ...) #1
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list