[all-commits] [llvm/llvm-project] df7481: [CIR] Implement PromotableRegionOpInterface for ci...
David Rivera via All-commits
all-commits at lists.llvm.org
Mon Sep 7 14:07:54 PDT 2026
Branch: refs/heads/users/riverdave/cir-mem2reg-regions
Home: https://github.com/llvm/llvm-project
Commit: df7481cddf10e6d6ef23d37053d061e732873ee8
https://github.com/llvm/llvm-project/commit/df7481cddf10e6d6ef23d37053d061e732873ee8
Author: David Rivera <davidriverg at gmail.com>
Date: 2026-09-07 (Mon, 07 Sep 2026)
Changed paths:
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/lib/CIR/Dialect/IR/CIRMemorySlot.cpp
A clang/test/CIR/Transforms/mem2reg-regions.cir
Log Message:
-----------
[CIR] Implement PromotableRegionOpInterface for cir.if
mem2reg gives up on a memory slot as soon as one of its uses lives in a
nested region whose parent op does not implement
PromotableRegionOpInterface. Since no CIR op implements it, promoting a
slot read inside a cir.if required running cir-flatten-cfg first, which
is why clang/test/CIR/Transforms/mem2reg.cir has to flatten before it can
promote anything.
Implement the interface for cir.if. Both regions are entered directly
from before the operation, so both see the same reaching definition.
A definition created inside a region has to leave the operation through
one of its results, and cir.if has none, so isRegionPromotable refuses
regions that store to the slot. Supporting those requires giving cir.if
results and is left for later.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
Commit: 008169dd5a63391be115f3e530e368711f373697
https://github.com/llvm/llvm-project/commit/008169dd5a63391be115f3e530e368711f373697
Author: David Rivera <davidriverg at gmail.com>
Date: 2026-09-07 (Mon, 07 Sep 2026)
Changed paths:
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/lib/CIR/Dialect/IR/CIRMemorySlot.cpp
M clang/test/CIR/Transforms/mem2reg-regions.cir
Log Message:
-----------
[CIR] Implement PromotableRegionOpInterface for cir.scope
Same treatment as cir.if: a slot read inside a cir.scope no longer needs
the CFG flattened before mem2reg can promote it. The scope region is
entered directly from before the operation, so it sees the reaching
definition unchanged.
cir.scope yields at most one value and may already be using it for the
scope's own result, so regions that store to the slot are refused.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
Commit: 2f2f4d8c675536388a32085a1383332f3143cb7f
https://github.com/llvm/llvm-project/commit/2f2f4d8c675536388a32085a1383332f3143cb7f
Author: David Rivera <davidriverg at gmail.com>
Date: 2026-09-07 (Mon, 07 Sep 2026)
Changed paths:
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/lib/CIR/Dialect/IR/CIRMemorySlot.cpp
A clang/test/CIR/Transforms/mem2reg-regions.c
M clang/test/CIR/Transforms/mem2reg-regions.cir
Log Message:
-----------
Extend PromotableRegionOpInterface for TernaryOp and add extra test coverage
Compare: https://github.com/llvm/llvm-project/compare/57dc48089b49...2f2f4d8c6755
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list