Skip to content

Commit 4b6e3e3

Browse files
authored
[Attributor] Improve debug string of AAUnderlyingObjects (#101861)
1 parent a0afcbf commit 4b6e3e3

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11874,14 +11874,24 @@ struct AAUnderlyingObjectsImpl
1187411874

1187511875
/// See AbstractAttribute::getAsStr().
1187611876
const std::string getAsStr(Attributor *A) const override {
11877-
return std::string("UnderlyingObjects ") +
11878-
(isValidState()
11879-
? (std::string("inter #") +
11880-
std::to_string(InterAssumedUnderlyingObjects.size()) +
11881-
" objs" + std::string(", intra #") +
11882-
std::to_string(IntraAssumedUnderlyingObjects.size()) +
11883-
" objs")
11884-
: "<invalid>");
11877+
if (!isValidState())
11878+
return "<invalid>";
11879+
std::string Str;
11880+
llvm::raw_string_ostream OS(Str);
11881+
OS << "underlying objects: inter " << InterAssumedUnderlyingObjects.size()
11882+
<< " objects, intra " << IntraAssumedUnderlyingObjects.size()
11883+
<< " objects.\n";
11884+
if (!InterAssumedUnderlyingObjects.empty()) {
11885+
OS << "inter objects:\n";
11886+
for (auto *Obj : InterAssumedUnderlyingObjects)
11887+
OS << *Obj << '\n';
11888+
}
11889+
if (!IntraAssumedUnderlyingObjects.empty()) {
11890+
OS << "intra objects:\n";
11891+
for (auto *Obj : IntraAssumedUnderlyingObjects)
11892+
OS << *Obj << '\n';
11893+
}
11894+
return Str;
1188511895
}
1188611896

1188711897
/// See AbstractAttribute::trackStatistics()

0 commit comments

Comments
 (0)