[llvm-commits] [llvm] r131849 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/crash.ll
Chris Lattner
sabre at nondot.org
Sun May 22 00:15:13 PDT 2011
Author: lattner
Date: Sun May 22 02:15:13 2011
New Revision: 131849
URL: http://llvm.org/viewvc/llvm-project?rev=131849&view=rev
Log:
fix PR9856, an incorrectly conservative assertion: a global can be
"stored once" even if its address is compared.
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
llvm/trunk/test/Transforms/GlobalOpt/crash.ll
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=131849&r1=131848&r2=131849&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sun May 22 02:15:13 2011
@@ -799,7 +799,8 @@
// If we get here we could have other crazy uses that are transitively
// loaded.
assert((isa<PHINode>(GlobalUser) || isa<SelectInst>(GlobalUser) ||
- isa<ConstantExpr>(GlobalUser)) && "Only expect load and stores!");
+ isa<ConstantExpr>(GlobalUser) || isa<CmpInst>(GlobalUser)) &&
+ "Only expect load and stores!");
}
}
@@ -1589,8 +1590,7 @@
GV->getInitializer()->isNullValue()) {
if (Constant *SOVC = dyn_cast<Constant>(StoredOnceVal)) {
if (GV->getInitializer()->getType() != SOVC->getType())
- SOVC =
- ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType());
+ SOVC = ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType());
// Optimize away any trapping uses of the loaded value.
if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC))
Modified: llvm/trunk/test/Transforms/GlobalOpt/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/crash.ll?rev=131849&r1=131848&r2=131849&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/crash.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/crash.ll Sun May 22 02:15:13 2011
@@ -64,3 +64,17 @@
ret void
}
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
+
+
+; PR9856
+ at g_52 = internal global i32** null, align 8
+ at g_90 = external global i32*, align 8
+
+define void @icmp_user_of_stored_once() nounwind ssp {
+entry:
+ %tmp4 = load i32*** @g_52, align 8
+ store i32** @g_90, i32*** @g_52
+ %cmp17 = icmp ne i32*** undef, @g_52
+ ret void
+}
+
More information about the llvm-commits
mailing list