@@ -137,17 +137,17 @@ static cl::opt<std::string>
137
137
// / Extract Module out of \p IR unit. May return nullptr if \p IR does not match
138
138
// / certain global filters. Will never return nullptr if \p Force is true.
139
139
const Module *unwrapModule (Any IR, bool Force = false ) {
140
- if (const auto **M = any_cast<const Module *>(&IR))
140
+ if (const auto **M = llvm:: any_cast<const Module *>(&IR))
141
141
return *M;
142
142
143
- if (const auto **F = any_cast<const Function *>(&IR)) {
143
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR)) {
144
144
if (!Force && !isFunctionInPrintList ((*F)->getName ()))
145
145
return nullptr ;
146
146
147
147
return (*F)->getParent ();
148
148
}
149
149
150
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR)) {
150
+ if (const auto **C = llvm:: any_cast<const LazyCallGraph::SCC *>(&IR)) {
151
151
for (const LazyCallGraph::Node &N : **C) {
152
152
const Function &F = N.getFunction ();
153
153
if (Force || (!F.isDeclaration () && isFunctionInPrintList (F.getName ()))) {
@@ -158,7 +158,7 @@ const Module *unwrapModule(Any IR, bool Force = false) {
158
158
return nullptr ;
159
159
}
160
160
161
- if (const auto **L = any_cast<const Loop *>(&IR)) {
161
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR)) {
162
162
const Function *F = (*L)->getHeader ()->getParent ();
163
163
if (!Force && !isFunctionInPrintList (F->getName ()))
164
164
return nullptr ;
@@ -201,16 +201,16 @@ void printIR(raw_ostream &OS, const Loop *L) {
201
201
}
202
202
203
203
std::string getIRName (Any IR) {
204
- if (any_cast<const Module *>(&IR))
204
+ if (llvm:: any_cast<const Module *>(&IR))
205
205
return " [module]" ;
206
206
207
- if (const auto **F = any_cast<const Function *>(&IR))
207
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR))
208
208
return (*F)->getName ().str ();
209
209
210
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR))
210
+ if (const auto **C = llvm:: any_cast<const LazyCallGraph::SCC *>(&IR))
211
211
return (*C)->getName ();
212
212
213
- if (const auto **L = any_cast<const Loop *>(&IR))
213
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR))
214
214
return (*L)->getName ().str ();
215
215
216
216
llvm_unreachable (" Unknown wrapped IR type" );
@@ -233,16 +233,16 @@ bool sccContainsFilterPrintFunc(const LazyCallGraph::SCC &C) {
233
233
}
234
234
235
235
bool shouldPrintIR (Any IR) {
236
- if (const auto **M = any_cast<const Module *>(&IR))
236
+ if (const auto **M = llvm:: any_cast<const Module *>(&IR))
237
237
return moduleContainsFilterPrintFunc (**M);
238
238
239
- if (const auto **F = any_cast<const Function *>(&IR))
239
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR))
240
240
return isFunctionInPrintList ((*F)->getName ());
241
241
242
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR))
242
+ if (const auto **C = llvm:: any_cast<const LazyCallGraph::SCC *>(&IR))
243
243
return sccContainsFilterPrintFunc (**C);
244
244
245
- if (const auto **L = any_cast<const Loop *>(&IR))
245
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR))
246
246
return isFunctionInPrintList ((*L)->getHeader ()->getParent ()->getName ());
247
247
llvm_unreachable (" Unknown wrapped IR type" );
248
248
}
@@ -260,22 +260,22 @@ void unwrapAndPrint(raw_ostream &OS, Any IR) {
260
260
return ;
261
261
}
262
262
263
- if (const auto **M = any_cast<const Module *>(&IR)) {
263
+ if (const auto **M = llvm:: any_cast<const Module *>(&IR)) {
264
264
printIR (OS, *M);
265
265
return ;
266
266
}
267
267
268
- if (const auto **F = any_cast<const Function *>(&IR)) {
268
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR)) {
269
269
printIR (OS, *F);
270
270
return ;
271
271
}
272
272
273
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR)) {
273
+ if (const auto **C = llvm:: any_cast<const LazyCallGraph::SCC *>(&IR)) {
274
274
printIR (OS, *C);
275
275
return ;
276
276
}
277
277
278
- if (const auto **L = any_cast<const Loop *>(&IR)) {
278
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR)) {
279
279
printIR (OS, *L);
280
280
return ;
281
281
}
@@ -306,9 +306,9 @@ std::string makeHTMLReady(StringRef SR) {
306
306
307
307
// Return the module when that is the appropriate level of comparison for \p IR.
308
308
const Module *getModuleForComparison (Any IR) {
309
- if (const auto **M = any_cast<const Module *>(&IR))
309
+ if (const auto **M = llvm:: any_cast<const Module *>(&IR))
310
310
return *M;
311
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR))
311
+ if (const auto **C = llvm:: any_cast<const LazyCallGraph::SCC *>(&IR))
312
312
return (*C)
313
313
->begin ()
314
314
->getFunction ()
@@ -325,7 +325,7 @@ bool isInterestingFunction(const Function &F) {
325
325
bool isInteresting (Any IR, StringRef PassID, StringRef PassName) {
326
326
if (isIgnored (PassID) || !isPassInPrintList (PassName))
327
327
return false ;
328
- if (const auto **F = any_cast<const Function *>(&IR))
328
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR))
329
329
return isInterestingFunction (**F);
330
330
return true ;
331
331
}
@@ -648,10 +648,10 @@ template <typename T> void IRComparer<T>::analyzeIR(Any IR, IRDataT<T> &Data) {
648
648
return ;
649
649
}
650
650
651
- const Function **FPtr = any_cast<const Function *>(&IR);
651
+ const Function **FPtr = llvm:: any_cast<const Function *>(&IR);
652
652
const Function *F = FPtr ? *FPtr : nullptr ;
653
653
if (!F) {
654
- const Loop **L = any_cast<const Loop *>(&IR);
654
+ const Loop **L = llvm:: any_cast<const Loop *>(&IR);
655
655
assert (L && " Unknown IR unit." );
656
656
F = (*L)->getHeader ()->getParent ();
657
657
}
@@ -837,10 +837,10 @@ void OptNoneInstrumentation::registerCallbacks(
837
837
}
838
838
839
839
bool OptNoneInstrumentation::shouldRun (StringRef PassID, Any IR) {
840
- const Function **FPtr = any_cast<const Function *>(&IR);
840
+ const Function **FPtr = llvm:: any_cast<const Function *>(&IR);
841
841
const Function *F = FPtr ? *FPtr : nullptr ;
842
842
if (!F) {
843
- if (const auto **L = any_cast<const Loop *>(&IR))
843
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR))
844
844
F = (*L)->getHeader ()->getParent ();
845
845
}
846
846
bool ShouldRun = !(F && F->hasOptNone ());
@@ -916,13 +916,14 @@ void PrintPassInstrumentation::registerCallbacks(
916
916
917
917
auto &OS = print ();
918
918
OS << " Running pass: " << PassID << " on " << getIRName (IR);
919
- if (const auto **F = any_cast<const Function *>(&IR)) {
919
+ if (const auto **F = llvm:: any_cast<const Function *>(&IR)) {
920
920
unsigned Count = (*F)->getInstructionCount ();
921
921
OS << " (" << Count << " instruction" ;
922
922
if (Count != 1 )
923
923
OS << ' s' ;
924
924
OS << ' )' ;
925
- } else if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR)) {
925
+ } else if (const auto **C =
926
+ llvm::any_cast<const LazyCallGraph::SCC *>(&IR)) {
926
927
int Count = (*C)->size ();
927
928
OS << " (" << Count << " node" ;
928
929
if (Count != 1 )
@@ -1138,9 +1139,9 @@ bool PreservedCFGCheckerInstrumentation::CFG::invalidate(
1138
1139
static SmallVector<Function *, 1 > GetFunctions (Any IR) {
1139
1140
SmallVector<Function *, 1 > Functions;
1140
1141
1141
- if (const auto **MaybeF = any_cast<const Function *>(&IR)) {
1142
+ if (const auto **MaybeF = llvm:: any_cast<const Function *>(&IR)) {
1142
1143
Functions.push_back (*const_cast <Function **>(MaybeF));
1143
- } else if (const auto **MaybeM = any_cast<const Module *>(&IR)) {
1144
+ } else if (const auto **MaybeM = llvm:: any_cast<const Module *>(&IR)) {
1144
1145
for (Function &F : **const_cast <Module **>(MaybeM))
1145
1146
Functions.push_back (&F);
1146
1147
}
@@ -1176,7 +1177,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
1176
1177
FAM.getResult <PreservedFunctionHashAnalysis>(*F);
1177
1178
}
1178
1179
1179
- if (auto *MaybeM = any_cast<const Module *>(&IR)) {
1180
+ if (auto *MaybeM = llvm:: any_cast<const Module *>(&IR)) {
1180
1181
Module &M = **const_cast <Module **>(MaybeM);
1181
1182
MAM.getResult <PreservedModuleHashAnalysis>(M);
1182
1183
}
@@ -1235,7 +1236,7 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
1235
1236
CheckCFG (P, F->getName (), *GraphBefore,
1236
1237
CFG (F, /* TrackBBLifetime */ false ));
1237
1238
}
1238
- if (auto *MaybeM = any_cast<const Module *>(&IR)) {
1239
+ if (auto *MaybeM = llvm:: any_cast<const Module *>(&IR)) {
1239
1240
Module &M = **const_cast <Module **>(MaybeM);
1240
1241
if (auto *HashBefore =
1241
1242
MAM.getCachedResult <PreservedModuleHashAnalysis>(M)) {
@@ -1254,10 +1255,10 @@ void VerifyInstrumentation::registerCallbacks(
1254
1255
[this ](StringRef P, Any IR, const PreservedAnalyses &PassPA) {
1255
1256
if (isIgnored (P) || P == " VerifierPass" )
1256
1257
return ;
1257
- const Function **FPtr = any_cast<const Function *>(&IR);
1258
+ const Function **FPtr = llvm:: any_cast<const Function *>(&IR);
1258
1259
const Function *F = FPtr ? *FPtr : nullptr ;
1259
1260
if (!F) {
1260
- if (const auto **L = any_cast<const Loop *>(&IR))
1261
+ if (const auto **L = llvm:: any_cast<const Loop *>(&IR))
1261
1262
F = (*L)->getHeader ()->getParent ();
1262
1263
}
1263
1264
@@ -1268,10 +1269,11 @@ void VerifyInstrumentation::registerCallbacks(
1268
1269
if (verifyFunction (*F, &errs ()))
1269
1270
report_fatal_error (" Broken function found, compilation aborted!" );
1270
1271
} else {
1271
- const Module **MPtr = any_cast<const Module *>(&IR);
1272
+ const Module **MPtr = llvm:: any_cast<const Module *>(&IR);
1272
1273
const Module *M = MPtr ? *MPtr : nullptr ;
1273
1274
if (!M) {
1274
- if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR))
1275
+ if (const auto **C =
1276
+ llvm::any_cast<const LazyCallGraph::SCC *>(&IR))
1275
1277
M = (*C)->begin ()->getFunction ().getParent ();
1276
1278
}
1277
1279
0 commit comments