[llvm] 093b43f - Sink getGCResultLocality to sole use [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 09:34:06 PST 2022
Author: Philip Reames
Date: 2022-01-31T09:33:57-08:00
New Revision: 093b43f48d0d6d78e1dc102dc11507e1d6ef1624
URL: https://github.com/llvm/llvm-project/commit/093b43f48d0d6d78e1dc102dc11507e1d6ef1624
DIFF: https://github.com/llvm/llvm-project/commit/093b43f48d0d6d78e1dc102dc11507e1d6ef1624.diff
LOG: Sink getGCResultLocality to sole use [NFC]
Added:
Modified:
llvm/include/llvm/IR/Statepoint.h
llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index a254a67e6b1f7..04a1dbcaafb89 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -204,11 +204,6 @@ class GCStatepointInst : public CallBase {
/// For example this could happen due to relocations on unwinding
/// path of invoke.
inline std::vector<const GCRelocateInst *> getGCRelocates() const;
-
- /// Returns pair of boolean flags. The first one is true is there is
- /// a gc.result intrinsic in the same block as statepoint. The second flag
- /// is true if there is an intrinsic outside of the block with statepoint.
- inline std::pair<bool, bool> getGCResultLocality() const;
};
std::vector<const GCRelocateInst *> GCStatepointInst::getGCRelocates() const {
@@ -236,18 +231,6 @@ std::vector<const GCRelocateInst *> GCStatepointInst::getGCRelocates() const {
return Result;
}
-std::pair<bool, bool> GCStatepointInst::getGCResultLocality() const {
- std::pair<bool, bool> Res(false, false);
- for (auto *U : users())
- if (auto *GRI = dyn_cast<GCResultInst>(U)) {
- if (GRI->getParent() == this->getParent())
- Res.first = true;
- else
- Res.second = true;
- }
- return Res;
-}
-
/// Call sites that get wrapped by a gc.statepoint (currently only in
/// RewriteStatepointsForGC and potentially in other passes in the future) can
/// have attributes that describe properties of gc.statepoint call they will be
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index e2db9633bfb9f..2e8769eb84a52 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -990,6 +990,18 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
return ReturnVal;
}
+static std::pair<bool, bool> getGCResultLocality(const GCStatepointInst &S) {
+ std::pair<bool, bool> Res(false, false);
+ for (auto *U : S.users())
+ if (auto *GRI = dyn_cast<GCResultInst>(U)) {
+ if (GRI->getParent() == S.getParent())
+ Res.first = true;
+ else
+ Res.second = true;
+ }
+ return Res;
+}
+
void
SelectionDAGBuilder::LowerStatepoint(const GCStatepointInst &I,
const BasicBlock *EHPadBB /*= nullptr*/) {
@@ -1075,7 +1087,7 @@ SelectionDAGBuilder::LowerStatepoint(const GCStatepointInst &I,
SDValue ReturnValue = LowerAsSTATEPOINT(SI);
// Export the result value if needed
- const std::pair<bool, bool> GCResultLocality = I.getGCResultLocality();
+ const std::pair<bool, bool> GCResultLocality = getGCResultLocality(I);
Type *RetTy = I.getActualReturnType();
if (RetTy->isVoidTy() ||
More information about the llvm-commits
mailing list