Rename mayBeMemoryDependent to mayHaveNonDefUseDependency [nfc]

This commit is contained in:
Philip Reames 2022-03-21 10:01:24 -07:00
parent 95cf1903cf
commit ee7324b898
5 changed files with 18 additions and 17 deletions

View File

@ -464,14 +464,14 @@ constexpr unsigned MaxAnalysisRecursionDepth = 6;
const TargetLibraryInfo *TLI = nullptr);
/// Returns true if the result or effects of the given instructions \p I
/// depend on or influence global memory.
/// Memory dependence arises for example if the instruction reads from
/// memory or may produce effects or undefined behaviour. Memory dependent
/// instructions generally cannot be reorderd with respect to other memory
/// dependent instructions or moved into non-dominated basic blocks.
/// Instructions which just compute a value based on the values of their
/// operands are not memory dependent.
bool mayBeMemoryDependent(const Instruction &I);
/// depend values not reachable through the def use graph.
/// * Memory dependence arises for example if the instruction reads from
/// memory or may produce effects or undefined behaviour. Memory dependent
/// instructions generally cannot be reorderd with respect to other memory
/// dependent instructions.
/// * Control dependence arises for example if the instruction may fault
/// if lifted above a throwing call or infinite loop.
bool mayHaveNonDefUseDependency(const Instruction &I);
/// Return true if it is an intrinsic that cannot be speculated but also
/// cannot trap.

View File

@ -4643,7 +4643,7 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V,
}
}
bool llvm::mayBeMemoryDependent(const Instruction &I) {
bool llvm::mayHaveNonDefUseDependency(const Instruction &I) {
return I.mayReadOrWriteMemory() || !isSafeToSpeculativelyExecute(&I);
}

View File

@ -1404,7 +1404,7 @@ auto HexagonVectorCombine::isSafeToMoveBeforeInBB(const Instruction &In,
if (isa<PHINode>(In) || (To != Block.end() && isa<PHINode>(*To)))
return false;
if (!mayBeMemoryDependent(In))
if (!mayHaveNonDefUseDependency(In))
return true;
bool MayWrite = In.mayWriteToMemory();
auto MaybeLoc = getLocOrNone(In);

View File

@ -180,7 +180,7 @@ void ReassociatePass::BuildRankMap(Function &F,
// we cannot move. This ensures that the ranks for these instructions are
// all different in the block.
for (Instruction &I : *BB)
if (mayBeMemoryDependent(I))
if (mayHaveNonDefUseDependency(I))
ValueRankMap[&I] = ++BBRank;
}
}

View File

@ -778,12 +778,13 @@ static bool areAllOperandsNonInsts(Value *V) {
auto *I = dyn_cast<Instruction>(V);
if (!I)
return true;
return !mayBeMemoryDependent(*I) && all_of(I->operands(), [I](Value *V) {
auto *IO = dyn_cast<Instruction>(V);
if (!IO)
return true;
return isa<PHINode>(IO) || IO->getParent() != I->getParent();
});
return !mayHaveNonDefUseDependency(*I) &&
all_of(I->operands(), [I](Value *V) {
auto *IO = dyn_cast<Instruction>(V);
if (!IO)
return true;
return isa<PHINode>(IO) || IO->getParent() != I->getParent();
});
}
/// Checks if the provided value does not require scheduling. It does not