@@ -44,6 +44,10 @@ cl::opt<bool> NoGlobalRM("disable-global-remove",
44
44
cl::desc (" Do not remove global variables" ),
45
45
cl::init(false ));
46
46
47
+ cl::opt<bool > NoAttributeRM (" disable-attribute-remove" ,
48
+ cl::desc (" Do not remove function attributes" ),
49
+ cl::init(false ));
50
+
47
51
cl::opt<bool > ReplaceFuncsWithNull (
48
52
" replace-funcs-with-null" ,
49
53
cl::desc (" When stubbing functions, replace all uses will null" ),
@@ -1203,36 +1207,38 @@ static Error DebugACrash(BugDriver &BD, BugTester TestFn) {
1203
1207
BD.EmitProgressBitcode (BD.getProgram (), " reduced-function" );
1204
1208
}
1205
1209
1206
- // For each remaining function, try to reduce that function's attributes.
1207
- std::vector<std::string> FunctionNames;
1208
- for (Function &F : BD.getProgram ())
1209
- FunctionNames.push_back (F.getName ());
1210
+ if (!NoAttributeRM) {
1211
+ // For each remaining function, try to reduce that function's attributes.
1212
+ std::vector<std::string> FunctionNames;
1213
+ for (Function &F : BD.getProgram ())
1214
+ FunctionNames.push_back (F.getName ());
1210
1215
1211
- if (!FunctionNames.empty () && !BugpointIsInterrupted) {
1212
- outs () << " \n *** Attempting to reduce the number of function attributes in "
1213
- " the testcase\n " ;
1216
+ if (!FunctionNames.empty () && !BugpointIsInterrupted) {
1217
+ outs () << " \n *** Attempting to reduce the number of function attributes"
1218
+ " in the testcase\n " ;
1214
1219
1215
- unsigned OldSize = 0 ;
1216
- unsigned NewSize = 0 ;
1217
- for (std::string &Name : FunctionNames) {
1218
- Function *Fn = BD.getProgram ().getFunction (Name);
1219
- assert (Fn && " Could not find funcion?" );
1220
+ unsigned OldSize = 0 ;
1221
+ unsigned NewSize = 0 ;
1222
+ for (std::string &Name : FunctionNames) {
1223
+ Function *Fn = BD.getProgram ().getFunction (Name);
1224
+ assert (Fn && " Could not find funcion?" );
1220
1225
1221
- std::vector<Attribute> Attrs;
1222
- for (Attribute A : Fn->getAttributes ().getFnAttributes ())
1223
- Attrs.push_back (A);
1226
+ std::vector<Attribute> Attrs;
1227
+ for (Attribute A : Fn->getAttributes ().getFnAttributes ())
1228
+ Attrs.push_back (A);
1224
1229
1225
- OldSize += Attrs.size ();
1226
- Expected<bool > Result =
1230
+ OldSize += Attrs.size ();
1231
+ Expected<bool > Result =
1227
1232
ReduceCrashingFunctionAttributes (BD, Name, TestFn).reduceList (Attrs);
1228
- if (Error E = Result.takeError ())
1229
- return E;
1233
+ if (Error E = Result.takeError ())
1234
+ return E;
1230
1235
1231
- NewSize += Attrs.size ();
1232
- }
1236
+ NewSize += Attrs.size ();
1237
+ }
1233
1238
1234
- if (OldSize < NewSize)
1235
- BD.EmitProgressBitcode (BD.getProgram (), " reduced-function-attributes" );
1239
+ if (OldSize < NewSize)
1240
+ BD.EmitProgressBitcode (BD.getProgram (), " reduced-function-attributes" );
1241
+ }
1236
1242
}
1237
1243
1238
1244
// Attempt to change conditional branches into unconditional branches to
0 commit comments