@@ -160,32 +160,32 @@ MetadataSetTy
160
160
llvm::FindDebugInfoToIdentityMap (CloneFunctionChangeType Changes,
161
161
DebugInfoFinder &DIFinder,
162
162
DISubprogram *SPClonedWithinModule) {
163
+ if (Changes >= CloneFunctionChangeType::DifferentModule)
164
+ return {};
165
+
166
+ if (DIFinder.subprogram_count () == 0 )
167
+ assert (!SPClonedWithinModule &&
168
+ " Subprogram should be in DIFinder->subprogram_count()..." );
169
+
163
170
MetadataSetTy MD;
164
171
165
- if (Changes < CloneFunctionChangeType::DifferentModule &&
166
- DIFinder.subprogram_count () > 0 ) {
167
- // Avoid cloning types, compile units, and (other) subprograms.
168
- for (DISubprogram *ISP : DIFinder.subprograms ()) {
169
- if (ISP != SPClonedWithinModule)
170
- MD.insert (ISP);
171
- }
172
+ // Avoid cloning types, compile units, and (other) subprograms.
173
+ for (DISubprogram *ISP : DIFinder.subprograms ())
174
+ if (ISP != SPClonedWithinModule)
175
+ MD.insert (ISP);
172
176
173
- // If a subprogram isn't going to be cloned skip its lexical blocks as well.
174
- for (DIScope *S : DIFinder.scopes ()) {
175
- auto *LScope = dyn_cast<DILocalScope>(S);
176
- if (LScope && LScope->getSubprogram () != SPClonedWithinModule)
177
- MD.insert (S);
177
+ // If a subprogram isn't going to be cloned skip its lexical blocks as well.
178
+ for (DIScope *S : DIFinder.scopes ()) {
179
+ auto *LScope = dyn_cast<DILocalScope>(S);
180
+ if (LScope && LScope->getSubprogram () != SPClonedWithinModule)
181
+ MD.insert (S);
178
182
}
179
183
180
184
for (DICompileUnit *CU : DIFinder.compile_units ())
181
185
MD.insert (CU);
182
186
183
187
for (DIType *Type : DIFinder.types ())
184
188
MD.insert (Type);
185
- } else {
186
- assert (!SPClonedWithinModule &&
187
- " Subprogram should be in DIFinder->subprogram_count()..." );
188
- }
189
189
190
190
return MD;
191
191
}
0 commit comments