[clang] [llvm] [mlir] [LLVM] Improve IR parsing and printing for target memory locations (PR #176968)
Antonio Frighetto via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 21 03:37:52 PST 2026
================
@@ -240,6 +240,28 @@ template <typename LocationEnum> class MemoryEffectsBase {
return getWithoutLoc(Location::InaccessibleMem).doesNotAccessMemory();
}
+ bool isTargetMemLoc(IRMemLocation Loc) {
+ return static_cast<unsigned>(Loc) >=
+ static_cast<unsigned>(Location::FirstTarget);
+ }
+
+ // We need to check if target memory is the same for all locations.
+ // So it behaves the same as default read/write, but for Target
+ // locations only
+ bool targetMemSameForAll() {
+ std::optional<ModRefInfo> First;
+ for (unsigned ILoc = static_cast<unsigned>(IRMemLocation::FirstTarget);
+ ILoc <= static_cast<unsigned>(IRMemLocation::Last); ++ILoc) {
+ const auto Loc = static_cast<IRMemLocation>(ILoc);
+ ModRefInfo MR = getModRef(Loc);
----------------
antoniofrighetto wrote:
I think we don't need a std::optional here either, we could store First out of the loop, and start looping from IRMemLocation::FirstTarget + 1?
https://github.com/llvm/llvm-project/pull/176968
More information about the cfe-commits
mailing list