[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port MachineSink to NPM (PR #115434)
@@ -709,27 +724,57 @@ void MachineSinking::FindCycleSinkCandidates( } } -bool MachineSinking::runOnMachineFunction(MachineFunction &MF) { +PreservedAnalyses +MachineSinkingPass::run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM) { + if (MF.getFunction().hasOptNone()) +return PreservedAnalyses::all(); paperchalice wrote: `OptNoneInstrumentation` supports machine function now. This can be removed. https://github.com/llvm/llvm-project/pull/115434 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR][NFC] `DominanceInfo`: Share same impl for block/op dominance (PR #115587)
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/115587 >From 9979c6317d7410b8d8a9a06ecd404b2d4c495c3c Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 9 Nov 2024 07:13:07 +0100 Subject: [PATCH] [mlir][IR][NFC] `DominanceInfo`: Share same impl for block/op dominance The `properlyDominates` implementations for blocks and ops are very similar. This commit replaces them with a single implementation that operates on block iterators. That implementation can be used to implement both `properlyDominates` variants. Note: A subsequent commit will add a new public `properlyDominates` overload that accepts block iterators. That functionality can then be used to find a valid insertion point at which a range of values is defined (by utilizing post dominance). Depends on #115433. --- mlir/include/mlir/IR/Dominance.h | 28 +++ mlir/lib/IR/Dominance.cpp| 124 --- 2 files changed, 92 insertions(+), 60 deletions(-) diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index 933ec09c5ede29..a6b2475e12b1c6 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -113,12 +113,12 @@ class DominanceInfoBase { llvm::PointerIntPair getDominanceInfo(Region *region, bool needsDomTree) const; - /// Return "true" if the specified block A properly (post)dominates block B. - bool properlyDominatesImpl(Block *a, Block *b) const; - - /// Return "true" if the specified op A properly (post)dominates op B. - bool properlyDominatesImpl(Operation *a, Operation *b, - bool enclosingOpOk = true) const; + /// Return "true" if block iterator A properly (post)dominates block iterator + /// B. If `enclosingOk` is set, A is considered to (post)dominate B if A + /// encloses B. + bool properlyDominatesImpl(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, + bool enclosingOk = true) const; /// A mapping of regions to their base dominator tree and a cached /// "hasSSADominance" bit. This map does not contain dominator trees for @@ -151,9 +151,7 @@ class DominanceInfo : public detail::DominanceInfoBase { /// The `enclosingOpOk` flag says whether we should return true if the B op /// is enclosed by a region on A. bool properlyDominates(Operation *a, Operation *b, - bool enclosingOpOk = true) const { -return super::properlyDominatesImpl(a, b, enclosingOpOk); - } + bool enclosingOpOk = true) const; /// Return true if operation A dominates operation B, i.e. if A and B are the /// same operation or A properly dominates B. @@ -188,9 +186,7 @@ class DominanceInfo : public detail::DominanceInfoBase { /// Graph regions have only a single block. To be consistent with "proper /// dominance" of ops, the single block is considered to properly dominate /// itself in a graph region. - bool properlyDominates(Block *a, Block *b) const { -return super::properlyDominatesImpl(a, b); - } + bool properlyDominates(Block *a, Block *b) const; }; /// A class for computing basic postdominance information. @@ -200,9 +196,7 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if operation A properly postdominates operation B. bool properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk = true) { -return super::properlyDominatesImpl(a, b, enclosingOpOk); - } + bool enclosingOpOk = true); /// Return true if operation A postdominates operation B. bool postDominates(Operation *a, Operation *b) { @@ -210,9 +204,7 @@ class PostDominanceInfo : public detail::DominanceInfoBase { } /// Return true if the specified block A properly postdominates block B. - bool properlyPostDominates(Block *a, Block *b) { -return super::properlyDominatesImpl(a, b); - } + bool properlyPostDominates(Block *a, Block *b); /// Return true if the specified block A postdominates block B. bool postDominates(Block *a, Block *b) { diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 406e0f2d62d640..25bdc32dd6a2a7 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -213,61 +213,73 @@ DominanceInfoBase::findNearestCommonDominator(Block *a, return getDomTree(a->getParent()).findNearestCommonDominator(a, b); } -/// Return true if the specified block A properly dominates block B. -template -bool DominanceInfoBase::properlyDominatesImpl(Block *a, - Block *b) const { - assert(a && b && "null blocks not allowed"); +/// Returns the given block iterator if it lies within the region region. +/// Otherwise, otherwise finds the ancestor of the given block iterator that +/// lies within the given region. Ret
[llvm-branch-commits] [mlir] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` (PR #115597)
https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/115597 Same as `DominanceInfo`, all functions should be `const`. Depends on #115587. >From caea72f975d38481d0544f52804192134a76 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 9 Nov 2024 10:40:09 +0100 Subject: [PATCH] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` Same as `DominanceInfo`, all functions should be `const`. Depends on #115587. --- mlir/include/mlir/IR/Dominance.h | 8 mlir/lib/IR/Dominance.cpp| 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index a6b2475e12b1c6..63504cad211a4d 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -196,18 +196,18 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if operation A properly postdominates operation B. bool properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk = true); + bool enclosingOpOk = true) const; /// Return true if operation A postdominates operation B. - bool postDominates(Operation *a, Operation *b) { + bool postDominates(Operation *a, Operation *b) const { return a == b || properlyPostDominates(a, b); } /// Return true if the specified block A properly postdominates block B. - bool properlyPostDominates(Block *a, Block *b); + bool properlyPostDominates(Block *a, Block *b) const; /// Return true if the specified block A postdominates block B. - bool postDominates(Block *a, Block *b) { + bool postDominates(Block *a, Block *b) const { return a == b || properlyPostDominates(a, b); } }; diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 25bdc32dd6a2a7..1c54e09d29b9b5 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -352,13 +352,13 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const { //===--===// bool PostDominanceInfo::properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk) { + bool enclosingOpOk) const { return super::properlyDominatesImpl(a->getBlock(), a->getIterator(), b->getBlock(), b->getIterator(), enclosingOpOk); } -bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) { +bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) const { return super::properlyDominatesImpl(a, a->end(), b, b->end(), /*enclosingOk=*/true); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` (PR #115597)
llvmbot wrote: @llvm/pr-subscribers-mlir Author: Matthias Springer (matthias-springer) Changes Same as `DominanceInfo`, all functions should be `const`. Depends on #115587. --- Full diff: https://github.com/llvm/llvm-project/pull/115597.diff 2 Files Affected: - (modified) mlir/include/mlir/IR/Dominance.h (+4-4) - (modified) mlir/lib/IR/Dominance.cpp (+2-2) ``diff diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index a6b2475e12b1c6..63504cad211a4d 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -196,18 +196,18 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if operation A properly postdominates operation B. bool properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk = true); + bool enclosingOpOk = true) const; /// Return true if operation A postdominates operation B. - bool postDominates(Operation *a, Operation *b) { + bool postDominates(Operation *a, Operation *b) const { return a == b || properlyPostDominates(a, b); } /// Return true if the specified block A properly postdominates block B. - bool properlyPostDominates(Block *a, Block *b); + bool properlyPostDominates(Block *a, Block *b) const; /// Return true if the specified block A postdominates block B. - bool postDominates(Block *a, Block *b) { + bool postDominates(Block *a, Block *b) const { return a == b || properlyPostDominates(a, b); } }; diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 25bdc32dd6a2a7..1c54e09d29b9b5 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -352,13 +352,13 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const { //===--===// bool PostDominanceInfo::properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk) { + bool enclosingOpOk) const { return super::properlyDominatesImpl(a->getBlock(), a->getIterator(), b->getBlock(), b->getIterator(), enclosingOpOk); } -bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) { +bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) const { return super::properlyDominatesImpl(a, a->end(), b, b->end(), /*enclosingOk=*/true); } `` https://github.com/llvm/llvm-project/pull/115597 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] [PAC][lld] Do not emit warnings for `-z pac-plt` with valid PAuth core info (PR #112959)
kovdan01 wrote: ### Merge activity * **Nov 10, 1:05 AM EST**: A user started a stack merge that includes this pull request via [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/112959). https://github.com/llvm/llvm-project/pull/112959 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR] `DominanceInfo`: Deduplicate `properlyDominates` implementation (PR #115433)
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/115433 >From d6ab91c2006c758c592ed964ad790b85808d44e2 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Fri, 8 Nov 2024 08:12:08 +0100 Subject: [PATCH] [mlir][IR] `DominanceInfo`: Deduplicate `properlyDominates` implementation The implementations of `DominanceInfo::properlyDominates` and `PostDominanceInfo::properlyPostDominates` are almost identical: only one line of code is different. Define the function in `DominanceInfoBase` to avoid the code duplication. Note: This commit is not marked as NFC because `PostDominanceInfo::properlyPostDominates` now also has an `enclosingOpOk` argument. --- mlir/include/mlir/IR/Dominance.h | 21 -- mlir/lib/IR/Dominance.cpp| 110 ++- 2 files changed, 48 insertions(+), 83 deletions(-) diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index 15b033ec854fde..933ec09c5ede29 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -113,8 +113,12 @@ class DominanceInfoBase { llvm::PointerIntPair getDominanceInfo(Region *region, bool needsDomTree) const; - /// Return true if the specified block A properly dominates block B. - bool properlyDominates(Block *a, Block *b) const; + /// Return "true" if the specified block A properly (post)dominates block B. + bool properlyDominatesImpl(Block *a, Block *b) const; + + /// Return "true" if the specified op A properly (post)dominates op B. + bool properlyDominatesImpl(Operation *a, Operation *b, + bool enclosingOpOk = true) const; /// A mapping of regions to their base dominator tree and a cached /// "hasSSADominance" bit. This map does not contain dominator trees for @@ -147,7 +151,9 @@ class DominanceInfo : public detail::DominanceInfoBase { /// The `enclosingOpOk` flag says whether we should return true if the B op /// is enclosed by a region on A. bool properlyDominates(Operation *a, Operation *b, - bool enclosingOpOk = true) const; + bool enclosingOpOk = true) const { +return super::properlyDominatesImpl(a, b, enclosingOpOk); + } /// Return true if operation A dominates operation B, i.e. if A and B are the /// same operation or A properly dominates B. @@ -183,7 +189,7 @@ class DominanceInfo : public detail::DominanceInfoBase { /// dominance" of ops, the single block is considered to properly dominate /// itself in a graph region. bool properlyDominates(Block *a, Block *b) const { -return super::properlyDominates(a, b); +return super::properlyDominatesImpl(a, b); } }; @@ -193,7 +199,10 @@ class PostDominanceInfo : public detail::DominanceInfoBase { using super::super; /// Return true if operation A properly postdominates operation B. - bool properlyPostDominates(Operation *a, Operation *b); + bool properlyPostDominates(Operation *a, Operation *b, + bool enclosingOpOk = true) { +return super::properlyDominatesImpl(a, b, enclosingOpOk); + } /// Return true if operation A postdominates operation B. bool postDominates(Operation *a, Operation *b) { @@ -202,7 +211,7 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if the specified block A properly postdominates block B. bool properlyPostDominates(Block *a, Block *b) { -return super::properlyDominates(a, b); +return super::properlyDominatesImpl(a, b); } /// Return true if the specified block A postdominates block B. diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index bdd0febfa546e0..406e0f2d62d640 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -215,7 +215,8 @@ DominanceInfoBase::findNearestCommonDominator(Block *a, /// Return true if the specified block A properly dominates block B. template -bool DominanceInfoBase::properlyDominates(Block *a, Block *b) const { +bool DominanceInfoBase::properlyDominatesImpl(Block *a, + Block *b) const { assert(a && b && "null blocks not allowed"); // A block dominates, but does not properly dominate, itself unless this @@ -243,36 +244,14 @@ bool DominanceInfoBase::properlyDominates(Block *a, Block *b) const { return getDomTree(regionA).properlyDominates(a, b); } -/// Return true if the specified block is reachable from the entry block of -/// its region. template -bool DominanceInfoBase::isReachableFromEntry(Block *a) const { - // If this is the first block in its region, then it is obviously reachable. - Region *region = a->getParent(); - if (®ion->front() == a) -return true; - - // Otherwise this is some block in a multi-block region. Check DomTree. - return getDomTree(region).isReachableFromEntry(a); -} - -template class detail::DominanceInfoBase; -template class de
[llvm-branch-commits] [mlir] [mlir][IR][NFC] `DominanceInfo`: Share same impl for block/op dominance (PR #115587)
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/115587 >From 247e4db0cef5c0ce2f15bba482b1214ab4fabc5c Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 9 Nov 2024 07:13:07 +0100 Subject: [PATCH] [mlir][IR][NFC] `DominanceInfo`: Share same impl for block/op dominance The `properlyDominates` implementations for blocks and ops are very similar. This commit replaces them with a single implementation that operates on block iterators. That implementation can be used to implement both `properlyDominates` variants. Note: A subsequent commit will add a new public `properlyDominates` overload that accepts block iterators. That functionality can then be used to find a valid insertion point at which a range of values is defined (by utilizing post dominance). Depends on #115433. --- mlir/include/mlir/IR/Dominance.h | 28 +++ mlir/lib/IR/Dominance.cpp| 124 --- 2 files changed, 92 insertions(+), 60 deletions(-) diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index 933ec09c5ede29..a6b2475e12b1c6 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -113,12 +113,12 @@ class DominanceInfoBase { llvm::PointerIntPair getDominanceInfo(Region *region, bool needsDomTree) const; - /// Return "true" if the specified block A properly (post)dominates block B. - bool properlyDominatesImpl(Block *a, Block *b) const; - - /// Return "true" if the specified op A properly (post)dominates op B. - bool properlyDominatesImpl(Operation *a, Operation *b, - bool enclosingOpOk = true) const; + /// Return "true" if block iterator A properly (post)dominates block iterator + /// B. If `enclosingOk` is set, A is considered to (post)dominate B if A + /// encloses B. + bool properlyDominatesImpl(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, + bool enclosingOk = true) const; /// A mapping of regions to their base dominator tree and a cached /// "hasSSADominance" bit. This map does not contain dominator trees for @@ -151,9 +151,7 @@ class DominanceInfo : public detail::DominanceInfoBase { /// The `enclosingOpOk` flag says whether we should return true if the B op /// is enclosed by a region on A. bool properlyDominates(Operation *a, Operation *b, - bool enclosingOpOk = true) const { -return super::properlyDominatesImpl(a, b, enclosingOpOk); - } + bool enclosingOpOk = true) const; /// Return true if operation A dominates operation B, i.e. if A and B are the /// same operation or A properly dominates B. @@ -188,9 +186,7 @@ class DominanceInfo : public detail::DominanceInfoBase { /// Graph regions have only a single block. To be consistent with "proper /// dominance" of ops, the single block is considered to properly dominate /// itself in a graph region. - bool properlyDominates(Block *a, Block *b) const { -return super::properlyDominatesImpl(a, b); - } + bool properlyDominates(Block *a, Block *b) const; }; /// A class for computing basic postdominance information. @@ -200,9 +196,7 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if operation A properly postdominates operation B. bool properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk = true) { -return super::properlyDominatesImpl(a, b, enclosingOpOk); - } + bool enclosingOpOk = true); /// Return true if operation A postdominates operation B. bool postDominates(Operation *a, Operation *b) { @@ -210,9 +204,7 @@ class PostDominanceInfo : public detail::DominanceInfoBase { } /// Return true if the specified block A properly postdominates block B. - bool properlyPostDominates(Block *a, Block *b) { -return super::properlyDominatesImpl(a, b); - } + bool properlyPostDominates(Block *a, Block *b); /// Return true if the specified block A postdominates block B. bool postDominates(Block *a, Block *b) { diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 406e0f2d62d640..25bdc32dd6a2a7 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -213,61 +213,73 @@ DominanceInfoBase::findNearestCommonDominator(Block *a, return getDomTree(a->getParent()).findNearestCommonDominator(a, b); } -/// Return true if the specified block A properly dominates block B. -template -bool DominanceInfoBase::properlyDominatesImpl(Block *a, - Block *b) const { - assert(a && b && "null blocks not allowed"); +/// Returns the given block iterator if it lies within the region region. +/// Otherwise, otherwise finds the ancestor of the given block iterator that +/// lies within the given region. Ret
[llvm-branch-commits] [mlir] [mlir][IR] Add `OpBuilder::setInsertionPointAfterValues` (PR #114940)
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/114940 >From f716eaa7bfa4bf2e3971a908009255cccfd631df Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 9 Nov 2024 12:29:16 +0100 Subject: [PATCH] [mlir][IR] Add `OpBuilder::setInsertionPointAfterValues` --- mlir/include/mlir/IR/Builders.h | 14 +++ mlir/include/mlir/IR/Dominance.h | 23 + mlir/lib/IR/Builders.cpp | 42 3 files changed, 79 insertions(+) diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h index 6fb71ccefda151..bd3642f9f413dc 100644 --- a/mlir/include/mlir/IR/Builders.h +++ b/mlir/include/mlir/IR/Builders.h @@ -16,6 +16,7 @@ namespace mlir { class AffineExpr; +class PostDominanceInfo; class IRMapping; class UnknownLoc; class FileLineColLoc; @@ -435,6 +436,19 @@ class OpBuilder : public Builder { } } + /// Sets the insertion point to a place that post-dominates the definitions + /// of all given values. Returns "failure" and leaves the current insertion + /// point unchanged if no such insertion point exists. + /// + /// There may be multiple suitable insertion points. This function chooses an + /// insertion right after one of the given values. + /// + /// Note: Some of the given values may already have gone out of scope at the + /// selected insertion point. (E.g., because they are defined in a nested + /// region.) + LogicalResult setInsertionPointAfterValues(ArrayRef values, + const PostDominanceInfo &domInfo); + /// Sets the insertion point to the start of the specified block. void setInsertionPointToStart(Block *block) { setInsertionPoint(block, block->begin()); diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index 63504cad211a4d..be2dcec380b6cc 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -187,6 +187,17 @@ class DominanceInfo : public detail::DominanceInfoBase { /// dominance" of ops, the single block is considered to properly dominate /// itself in a graph region. bool properlyDominates(Block *a, Block *b) const; + + bool properlyDominantes(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, bool enclosingOk = true) const { +return super::properlyDominatesImpl(aBlock, aIt, bBlock, bIt, enclosingOk); + } + + bool dominantes(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, bool enclosingOk = true) const { +return (aBlock == bBlock && aIt == bIt) || + super::properlyDominatesImpl(aBlock, aIt, bBlock, bIt, enclosingOk); + } }; /// A class for computing basic postdominance information. @@ -210,6 +221,18 @@ class PostDominanceInfo : public detail::DominanceInfoBase { bool postDominates(Block *a, Block *b) const { return a == b || properlyPostDominates(a, b); } + + bool properlyPostDominantes(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, + bool enclosingOk = true) const { +return super::properlyDominatesImpl(aBlock, aIt, bBlock, bIt, enclosingOk); + } + + bool postDominantes(Block *aBlock, Block::iterator aIt, Block *bBlock, + Block::iterator bIt, bool enclosingOk = true) const { +return (aBlock == bBlock && aIt == bIt) || + super::properlyDominatesImpl(aBlock, aIt, bBlock, bIt, enclosingOk); + } }; } // namespace mlir diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp index 5397fbabc5c95e..0f4b5123326502 100644 --- a/mlir/lib/IR/Builders.cpp +++ b/mlir/lib/IR/Builders.cpp @@ -11,6 +11,7 @@ #include "mlir/IR/AffineMap.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" +#include "mlir/IR/Dominance.h" #include "mlir/IR/IRMapping.h" #include "mlir/IR/IntegerSet.h" #include "mlir/IR/Matchers.h" @@ -641,3 +642,44 @@ void OpBuilder::cloneRegionBefore(Region ®ion, Region &parent, void OpBuilder::cloneRegionBefore(Region ®ion, Block *before) { cloneRegionBefore(region, *before->getParent(), before->getIterator()); } + +LogicalResult +OpBuilder::setInsertionPointAfterValues(ArrayRef values, +const PostDominanceInfo &domInfo) { + // Helper function that computes the point after v's definition. + auto computeAfterIp = [](Value v) -> std::pair { +if (auto blockArg = dyn_cast(v)) + return std::make_pair(blockArg.getOwner(), blockArg.getOwner()->begin()); +Operation *op = v.getDefiningOp(); +return std::make_pair(op->getBlock(), op->getIterator()); + }; + + // Compute the insertion point after the first value is defined. + assert(!values.empty() && "expected at least one Value"); + auto [block, blockIt] = computeAfterIp(values.front()); + + // Check the other values one-by-one and update
[llvm-branch-commits] [mlir] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` (PR #115597)
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/115597 >From e890126d7db83c24ea574df177d915cfa011c696 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 9 Nov 2024 10:40:09 +0100 Subject: [PATCH] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` Same as `DominanceInfo`, all functions should be `const`. Depends on #115587. --- mlir/include/mlir/IR/Dominance.h | 8 mlir/lib/IR/Dominance.cpp| 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h index a6b2475e12b1c6..63504cad211a4d 100644 --- a/mlir/include/mlir/IR/Dominance.h +++ b/mlir/include/mlir/IR/Dominance.h @@ -196,18 +196,18 @@ class PostDominanceInfo : public detail::DominanceInfoBase { /// Return true if operation A properly postdominates operation B. bool properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk = true); + bool enclosingOpOk = true) const; /// Return true if operation A postdominates operation B. - bool postDominates(Operation *a, Operation *b) { + bool postDominates(Operation *a, Operation *b) const { return a == b || properlyPostDominates(a, b); } /// Return true if the specified block A properly postdominates block B. - bool properlyPostDominates(Block *a, Block *b); + bool properlyPostDominates(Block *a, Block *b) const; /// Return true if the specified block A postdominates block B. - bool postDominates(Block *a, Block *b) { + bool postDominates(Block *a, Block *b) const { return a == b || properlyPostDominates(a, b); } }; diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 25bdc32dd6a2a7..1c54e09d29b9b5 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -352,13 +352,13 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const { //===--===// bool PostDominanceInfo::properlyPostDominates(Operation *a, Operation *b, - bool enclosingOpOk) { + bool enclosingOpOk) const { return super::properlyDominatesImpl(a->getBlock(), a->getIterator(), b->getBlock(), b->getIterator(), enclosingOpOk); } -bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) { +bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) const { return super::properlyDominatesImpl(a, a->end(), b, b->end(), /*enclosingOk=*/true); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR] Add `OpBuilder::setInsertionPointAfterValues` (PR #114940)
https://github.com/matthias-springer edited https://github.com/llvm/llvm-project/pull/114940 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR] Add `OpBuilder::setInsertionPointAfterValues` (PR #114940)
https://github.com/matthias-springer edited https://github.com/llvm/llvm-project/pull/114940 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR] Add helper functions to compute insertion point (PR #114940)
https://github.com/matthias-springer edited https://github.com/llvm/llvm-project/pull/114940 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] [PAC][lld][AArch64][ELF] Support signed GOT with tiny code model (PR #113816)
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/113816 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] [PAC][lld][AArch64][ELF] Support signed GOT with tiny code model (PR #113816)
kovdan01 wrote: > I see a number of test failures, ATM. @ilovepi Yes, these are currently expected - as mentioned in the PR description, it depends on #114525 (codegen support for the feature). The dependency isn't included in the Graphite PR stack since this does not cause merge conflicts (different parts of llvm are altered) - I find it easier to keep PRs separate if it's possible and just mention unmerged dependencies in description (for me, it makes updating PRs more robust). https://github.com/llvm/llvm-project/pull/113816 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [PAC][clang] Add new features to pauthtest ABI (PR #113150)
kovdan01 wrote: Would be glad to see everyone's feedback on the changes. https://github.com/llvm/llvm-project/pull/113150 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [PAC][clang] Handle pauthtest environment and ABI in Linux-specific code (PR #113151)
kovdan01 wrote: Would be glad to see everyone's feedback on the changes. https://github.com/llvm/llvm-project/pull/113151 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [PAC][Driver] Support ptrauth flags only on AArch64 Linux and ARM64 Darwin (PR #113152)
kovdan01 wrote: Would be glad to see everyone's feedback on the changes. https://github.com/llvm/llvm-project/pull/113152 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [mlir][IR] Add `OpBuilder::setInsertionPointAfterValues` (PR #114940)
https://github.com/matthias-springer edited https://github.com/llvm/llvm-project/pull/114940 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits