mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Fix GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll and McGill/chomp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
22c8648b8a
commit
25de4e5c21
@ -104,17 +104,20 @@ struct GlobalStatus {
|
||||
/// ever stored to this global, keep track of what value it is.
|
||||
Value *StoredOnceValue;
|
||||
|
||||
// AccessingFunction/HasMultipleAccessingFunctions - These start out
|
||||
// null/false. When the first accessing function is noticed, it is recorded.
|
||||
// When a second different accessing function is noticed,
|
||||
// HasMultipleAccessingFunctions is set to true.
|
||||
/// AccessingFunction/HasMultipleAccessingFunctions - These start out
|
||||
/// null/false. When the first accessing function is noticed, it is recorded.
|
||||
/// When a second different accessing function is noticed,
|
||||
/// HasMultipleAccessingFunctions is set to true.
|
||||
Function *AccessingFunction;
|
||||
bool HasMultipleAccessingFunctions;
|
||||
|
||||
// HasNonInstructionUser - Set to true if this global has a user that is not
|
||||
// an instruction (e.g. a constant expr or GV initializer).
|
||||
/// HasNonInstructionUser - Set to true if this global has a user that is not
|
||||
/// an instruction (e.g. a constant expr or GV initializer).
|
||||
bool HasNonInstructionUser;
|
||||
|
||||
/// HasPHIUser - Set to true if this global has a user that is a PHI node.
|
||||
bool HasPHIUser;
|
||||
|
||||
/// isNotSuitableForSRA - Keep track of whether any SRA preventing users of
|
||||
/// the global exist. Such users include GEP instruction with variable
|
||||
/// indexes, and non-gep/load/store users like constant expr casts.
|
||||
@ -122,7 +125,8 @@ struct GlobalStatus {
|
||||
|
||||
GlobalStatus() : isLoaded(false), StoredType(NotStored), StoredOnceValue(0),
|
||||
AccessingFunction(0), HasMultipleAccessingFunctions(false),
|
||||
HasNonInstructionUser(false), isNotSuitableForSRA(false) {}
|
||||
HasNonInstructionUser(false), HasPHIUser(false),
|
||||
isNotSuitableForSRA(false) {}
|
||||
};
|
||||
|
||||
|
||||
@ -238,6 +242,7 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS,
|
||||
if (PHIUsers.insert(PN).second) // Not already visited.
|
||||
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
|
||||
GS.isNotSuitableForSRA = true;
|
||||
GS.HasPHIUser = true;
|
||||
} else if (isa<SetCondInst>(I)) {
|
||||
GS.isNotSuitableForSRA = true;
|
||||
} else if (isa<MemCpyInst>(I) || isa<MemMoveInst>(I)) {
|
||||
@ -1321,7 +1326,8 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
|
||||
// boolean.
|
||||
if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue))
|
||||
if (GV->getType()->getElementType() != Type::BoolTy &&
|
||||
!GV->getType()->getElementType()->isFloatingPoint()) {
|
||||
!GV->getType()->getElementType()->isFloatingPoint() &&
|
||||
!GS.HasPHIUser) {
|
||||
DEBUG(std::cerr << " *** SHRINKING TO BOOL: " << *GV);
|
||||
ShrinkGlobalToBoolean(GV, SOVConstant);
|
||||
++NumShrunkToBool;
|
||||
|
Loading…
Reference in New Issue
Block a user