[PATCH] D130587: [StandardInstrumentations] Assign names to basic blocks without names
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 2 11:06:48 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43aa4ac70b82: [StandardInstrumentations] Assign names to basic blocks without names (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130587/new/
https://reviews.llvm.org/D130587
Files:
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Other/ChangePrinters/print-changed-diff-empty-bb-name.ll
Index: llvm/test/Other/ChangePrinters/print-changed-diff-empty-bb-name.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/ChangePrinters/print-changed-diff-empty-bb-name.ll
@@ -0,0 +1,18 @@
+; RUN: opt -passes=inline %s -disable-output --print-changed=diff 2>&1 | FileCheck %s
+
+; CHECK: IR Dump After InlinerPass
+
+define void @f(i1 %i) {
+ call void @g(i1 %i)
+ ret void
+}
+
+define void @g(i1 %i) {
+ br i1 %i, label %1, label %2
+
+1:
+ ret void
+
+2:
+ ret void
+}
Index: llvm/lib/Passes/StandardInstrumentations.cpp
===================================================================
--- llvm/lib/Passes/StandardInstrumentations.cpp
+++ llvm/lib/Passes/StandardInstrumentations.cpp
@@ -615,9 +615,15 @@
bool IRComparer<T>::generateFunctionData(IRDataT<T> &Data, const Function &F) {
if (!F.isDeclaration() && isFunctionInPrintList(F.getName())) {
FuncDataT<T> FD(F.getEntryBlock().getName().str());
+ int I = 0;
for (const auto &B : F) {
- FD.getOrder().emplace_back(B.getName());
- FD.getData().insert({B.getName(), B});
+ std::string BBName = B.getName().str();
+ if (BBName.empty()) {
+ BBName = formatv("{0}", I);
+ ++I;
+ }
+ FD.getOrder().emplace_back(BBName);
+ FD.getData().insert({BBName, B});
}
Data.getOrder().emplace_back(F.getName());
Data.getData().insert({F.getName(), FD});
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130587.449349.patch
Type: text/x-patch
Size: 1439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220802/0622c72d/attachment.bin>
More information about the llvm-commits
mailing list