1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

fix a globalopt crash on two Adobe-C++ testcases that the recent

loop idiom pass exposed.

llvm-svn: 122674
This commit is contained in:
Chris Lattner 2011-01-01 22:31:46 +00:00
parent 2600dec19b
commit fda382af51
2 changed files with 14 additions and 0 deletions

View File

@ -167,6 +167,11 @@ static bool AnalyzeGlobal(const Value *V, GlobalStatus &GS,
const User *U = *UI; const User *U = *UI;
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) { if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) {
GS.HasNonInstructionUser = true; GS.HasNonInstructionUser = true;
// If the result of the constantexpr isn't pointer type, then we won't
// know to expect it in various places. Just reject early.
if (!isa<PointerType>(CE->getType())) return true;
if (AnalyzeGlobal(CE, GS, PHIUsers)) return true; if (AnalyzeGlobal(CE, GS, PHIUsers)) return true;
} else if (const Instruction *I = dyn_cast<Instruction>(U)) { } else if (const Instruction *I = dyn_cast<Instruction>(U)) {
if (!GS.HasMultipleAccessingFunctions) { if (!GS.HasMultipleAccessingFunctions) {

View File

@ -55,3 +55,12 @@ entry:
ret void ret void
} }
@data8 = internal global [8000 x i8] zeroinitializer, align 16
define void @memset_with_strange_user() ssp {
call void @llvm.memset.p0i8.i64(i8* getelementptr inbounds ([8000 x i8]* @data8, i64 0, i64 0), i8 undef, i64 ptrtoint (i8* getelementptr ([8000 x i8]* @data8, i64 1, i64 sub (i64 0, i64 ptrtoint ([8000 x i8]* @data8 to i64))) to i64), i32 16, i1 false)
ret void
}
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind