[StandardInstrumentations] Assign names to basic blocks without names
Fixes code in OrderedChangedData<T>::report which assumes that a string will only appear once in Before/After. Reviewed By: jamieschmeiser Differential Revision: https://reviews.llvm.org/D130587
This commit is contained in:
parent
eb5aeee02f
commit
43aa4ac70b
|
@ -615,9 +615,15 @@ template <typename T>
|
|||
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});
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue