From ee7324b898f775eb9ee14c23a4e57b9a2aa6e3f6 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Mon, 21 Mar 2022 10:01:24 -0700 Subject: [PATCH] Rename mayBeMemoryDependent to mayHaveNonDefUseDependency [nfc] --- llvm/include/llvm/Analysis/ValueTracking.h | 16 ++++++++-------- llvm/lib/Analysis/ValueTracking.cpp | 2 +- llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp | 2 +- llvm/lib/Transforms/Scalar/Reassociate.cpp | 2 +- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 13 +++++++------ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h index 8f04cf4..b97d628 100644 --- a/llvm/include/llvm/Analysis/ValueTracking.h +++ b/llvm/include/llvm/Analysis/ValueTracking.h @@ -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. diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 0cdfa5b..021e5d9 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -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); } diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp index 6aca8d8..4a5aa73 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp @@ -1404,7 +1404,7 @@ auto HexagonVectorCombine::isSafeToMoveBeforeInBB(const Instruction &In, if (isa(In) || (To != Block.end() && isa(*To))) return false; - if (!mayBeMemoryDependent(In)) + if (!mayHaveNonDefUseDependency(In)) return true; bool MayWrite = In.mayWriteToMemory(); auto MaybeLoc = getLocOrNone(In); diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 8876547..ed46038 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -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; } } diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index cfe50fc..926b76f 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -778,12 +778,13 @@ static bool areAllOperandsNonInsts(Value *V) { auto *I = dyn_cast(V); if (!I) return true; - return !mayBeMemoryDependent(*I) && all_of(I->operands(), [I](Value *V) { - auto *IO = dyn_cast(V); - if (!IO) - return true; - return isa(IO) || IO->getParent() != I->getParent(); - }); + return !mayHaveNonDefUseDependency(*I) && + all_of(I->operands(), [I](Value *V) { + auto *IO = dyn_cast(V); + if (!IO) + return true; + return isa(IO) || IO->getParent() != I->getParent(); + }); } /// Checks if the provided value does not require scheduling. It does not -- 2.7.4