[llvm-commits] [llvm] r131847 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/crash.ll
Chris Lattner
sabre at nondot.org
Sun May 22 00:03:34 PDT 2011
Author: lattner
Date: Sun May 22 02:03:34 2011
New Revision: 131847
URL: http://llvm.org/viewvc/llvm-project?rev=131847&view=rev
Log:
fix PR9841 by having GVN not process dead loads. This was
causing it to get into infinite loops when it would widen a
load (which can necessarily leave around dead loads).
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
llvm/trunk/test/Transforms/GVN/crash.ll
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=131847&r1=131846&r2=131847&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Sun May 22 02:03:34 2011
@@ -1607,6 +1607,11 @@
if (L->isVolatile())
return false;
+ if (L->use_empty()) {
+ markInstructionForDeletion(L);
+ return true;
+ }
+
// ... to a pointer that has been loaded from before...
MemDepResult Dep = MD->getDependency(L);
Modified: llvm/trunk/test/Transforms/GVN/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/crash.ll?rev=131847&r1=131846&r2=131847&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GVN/crash.ll (original)
+++ llvm/trunk/test/Transforms/GVN/crash.ll Sun May 22 02:03:34 2011
@@ -151,3 +151,15 @@
dead2:
ret i32 %A
}
+
+
+; PR9841
+define fastcc i8 @test5(i8* %P) nounwind {
+entry:
+ %0 = load i8* %P, align 2
+
+ %Q = getelementptr i8* %P, i32 1
+ %1 = load i8* %Q, align 1
+ ret i8 %1
+}
+
More information about the llvm-commits
mailing list