mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
More code cleanup [NFC]
Minor naming, one potentially unsafe cast git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -432,15 +432,15 @@ static Value *findBaseDefiningValue(Value *I) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the base defining value for this value.
|
/// Returns the base defining value for this value.
|
||||||
static Value *findBaseDefiningValueCached(Value *I, DefiningValueMapTy &cache) {
|
static Value *findBaseDefiningValueCached(Value *I, DefiningValueMapTy &Cache) {
|
||||||
Value *&Cached = cache[I];
|
Value *&Cached = Cache[I];
|
||||||
if (!Cached) {
|
if (!Cached) {
|
||||||
Cached = findBaseDefiningValue(I);
|
Cached = findBaseDefiningValue(I);
|
||||||
}
|
}
|
||||||
assert(cache[I] != nullptr);
|
assert(Cache[I] != nullptr);
|
||||||
|
|
||||||
if (TraceLSP) {
|
if (TraceLSP) {
|
||||||
errs() << "fBDV-cached: " << I->getName() << " -> " << Cached->getName()
|
dbgs() << "fBDV-cached: " << I->getName() << " -> " << Cached->getName()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
return Cached;
|
return Cached;
|
||||||
@@ -448,25 +448,26 @@ static Value *findBaseDefiningValueCached(Value *I, DefiningValueMapTy &cache) {
|
|||||||
|
|
||||||
/// Return a base pointer for this value if known. Otherwise, return it's
|
/// Return a base pointer for this value if known. Otherwise, return it's
|
||||||
/// base defining value.
|
/// base defining value.
|
||||||
static Value *findBaseOrBDV(Value *I, DefiningValueMapTy &cache) {
|
static Value *findBaseOrBDV(Value *I, DefiningValueMapTy &Cache) {
|
||||||
Value *def = findBaseDefiningValueCached(I, cache);
|
Value *Def = findBaseDefiningValueCached(I, Cache);
|
||||||
auto Found = cache.find(def);
|
auto Found = Cache.find(Def);
|
||||||
if (Found != cache.end()) {
|
if (Found != Cache.end()) {
|
||||||
// Either a base-of relation, or a self reference. Caller must check.
|
// Either a base-of relation, or a self reference. Caller must check.
|
||||||
return Found->second;
|
return Found->second;
|
||||||
}
|
}
|
||||||
// Only a BDV available
|
// Only a BDV available
|
||||||
return def;
|
return Def;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given the result of a call to findBaseDefiningValue, or findBaseOrBDV,
|
/// Given the result of a call to findBaseDefiningValue, or findBaseOrBDV,
|
||||||
/// is it known to be a base pointer? Or do we need to continue searching.
|
/// is it known to be a base pointer? Or do we need to continue searching.
|
||||||
static bool isKnownBaseResult(Value *v) {
|
static bool isKnownBaseResult(Value *V) {
|
||||||
if (!isa<PHINode>(v) && !isa<SelectInst>(v)) {
|
if (!isa<PHINode>(V) && !isa<SelectInst>(V)) {
|
||||||
// no recursion possible
|
// no recursion possible
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cast<Instruction>(v)->getMetadata("is_base_value")) {
|
if (isa<Instruction>(V) &&
|
||||||
|
cast<Instruction>(V)->getMetadata("is_base_value")) {
|
||||||
// This is a previously inserted base phi or select. We know
|
// This is a previously inserted base phi or select. We know
|
||||||
// that this is a base value.
|
// that this is a base value.
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user