[Mlir-commits] [mlir] [mlir][analysis] Cleanup collectUnderlyingAddressValues (NFC) (PR #177905)
Matthias Springer
llvmlistbot at llvm.org
Mon Jan 26 00:07:20 PST 2026
================
@@ -170,17 +170,15 @@ static void collectUnderlyingAddressValues(BlockArgument arg, unsigned maxDepth,
// the entry block.
SmallVector<RegionSuccessor> successors;
branch.getSuccessorRegions(RegionBranchPoint::parent(), successors);
- RegionSuccessor regionSuccessor(region);
- bool found = false;
+ RegionSuccessor regionSuccessor = RegionSuccessor::parent();
for (RegionSuccessor &successor : successors) {
if (successor.getSuccessor() == region) {
LDBG() << " Found matching region successor: " << successor;
- found = true;
regionSuccessor = successor;
----------------
matthias-springer wrote:
I think there's an even simpler way to write this:
- Drop `regionSuccessor` and `found` variable.
- Inside of this `if` check: `return collectUnderlyingAddressValues2(
branch, successor, arg, argNumber, maxDepth, visited, output);` and drop the `break;`.
- Drop the `if` check around `!found`.
https://github.com/llvm/llvm-project/pull/177905
More information about the Mlir-commits
mailing list