@@ -1066,13 +1066,8 @@ void removeRedundantBlockArgs(
1066
1066
}
1067
1067
}
1068
1068
1069
- std::set<std::string> NonCapturingFunctions = {
1070
- " free" , " printf" , " fprintf" , " scanf" ,
1071
- " fscanf" , " gettimeofday" , " clock_gettime" , " getenv" ,
1072
- " strrchr" , " strlen" , " sprintf" , " sscanf" ,
1073
- " mkdir" , " fwrite" , " fread" , " memcpy" ,
1074
- " cudaMemcpy" , " memset" , " cudaMemset" , " __isoc99_scanf" ,
1075
- " __isoc99_fscanf" };
1069
+ const std::set<std::string> &getNonCapturingFunctions ();
1070
+
1076
1071
// fopen, fclose
1077
1072
std::set<std::string> NoWriteFunctions = {" exit" , " __errno_location" };
1078
1073
// This is a straightforward implementation not optimized for speed. Optimize
@@ -1241,7 +1236,7 @@ bool Mem2Reg::forwardStoreToLoad(
1241
1236
if (callOp.getCallee () != " free" ) {
1242
1237
LLVM_DEBUG (llvm::dbgs () << " Aliasing Store: " << callOp << " \n " );
1243
1238
AliasingStoreOperations.insert (callOp);
1244
- if (!NonCapturingFunctions .count (callOp.getCallee ().str ()))
1239
+ if (!getNonCapturingFunctions () .count (callOp.getCallee ().str ()))
1245
1240
captured = true ;
1246
1241
}
1247
1242
continue ;
@@ -1251,7 +1246,7 @@ bool Mem2Reg::forwardStoreToLoad(
1251
1246
LLVM_DEBUG (llvm::dbgs () << " Aliasing Store: " << callOp << " \n " );
1252
1247
AliasingStoreOperations.insert (callOp);
1253
1248
if (!callOp.getCallee () ||
1254
- !NonCapturingFunctions .count (callOp.getCallee ()->str ()))
1249
+ !getNonCapturingFunctions () .count (callOp.getCallee ()->str ()))
1255
1250
captured = true ;
1256
1251
}
1257
1252
continue ;
@@ -1825,11 +1820,11 @@ bool isPromotable(mlir::Value AI) {
1825
1820
} else if (isa<memref::DeallocOp>(U)) {
1826
1821
continue ;
1827
1822
} else if (auto callOp = dyn_cast<func::CallOp>(U)) {
1828
- if (NonCapturingFunctions .count (callOp.getCallee ().str ()))
1823
+ if (getNonCapturingFunctions () .count (callOp.getCallee ().str ()))
1829
1824
continue ;
1830
1825
} else if (auto callOp = dyn_cast<LLVM::CallOp>(U)) {
1831
1826
if (auto callee = callOp.getCallee ())
1832
- if (NonCapturingFunctions .count (callee->str ()))
1827
+ if (getNonCapturingFunctions () .count (callee->str ()))
1833
1828
continue ;
1834
1829
} else if (auto CO = dyn_cast<memref::CastOp>(U)) {
1835
1830
list.push_back (CO);
0 commit comments