GlobalOpt forgot to handle bitcast when analyzing globals. Found by inspection.

llvm-svn: 159546
This commit is contained in:
Duncan Sands 2012-07-02 18:55:39 +00:00
parent 23eb3ecf32
commit 16235b1885
2 changed files with 5 additions and 1 deletions

View File

@ -254,6 +254,8 @@ static bool AnalyzeGlobal(const Value *V, GlobalStatus &GS,
GS.StoredType = GlobalStatus::isStored;
}
}
} else if (isa<BitCastInst>(I)) {
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
} else if (isa<GetElementPtrInst>(I)) {
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
} else if (isa<SelectInst>(I)) {

View File

@ -26,7 +26,9 @@ define i1 @bah(i64 %i) nounwind readonly optsize ssp {
entry:
%arrayidx4 = getelementptr inbounds [4 x i8]* @d, i64 0, i64 %i
%tmp5 = load i8* %arrayidx4, align 1
%cmp = icmp eq i8 %tmp5, 42
%array0 = bitcast [4 x i8]* @d to i8*
%tmp6 = load i8* %array0, align 1
%cmp = icmp eq i8 %tmp5, %tmp6
ret i1 %cmp
}