@@ -82,9 +82,15 @@ static cl::opt<bool>
82
82
ForceRetMemPassing (" vc-stack-force-ret-mem" ,
83
83
cl::desc (" Pass all stackcall retval via stackmem" ),
84
84
cl::init(false ));
85
- static cl::opt<bool > HandleMaskArgs (" vc-stack-handle-mask-args" ,
85
+ static cl::opt<bool >
86
+ DefaultMaskArgsProcessingPolicy (" vc-stack-handle-mask-args" ,
86
87
cl::desc (" Pass i1 arguments of stackcalls" ),
87
88
cl::init(true ));
89
+ static cl::opt<bool >
90
+ AbortOnSIMDCF (" vc-prologue-insertion-aborts-on-simdcf" ,
91
+ cl::desc (" fatal error is reported on simdcf detection by "
92
+ " prologue insertion pass" ),
93
+ cl::init(false ));
88
94
89
95
namespace {
90
96
@@ -126,6 +132,7 @@ class GenXPrologEpilogInsertion
126
132
unsigned ArgRegSize = 0 ;
127
133
unsigned RetRegSize = 0 ;
128
134
135
+ bool HandleMaskArgs = true ;
129
136
bool UseGlobalMem = true ;
130
137
131
138
void generateKernelProlog (Function &F);
@@ -249,6 +256,7 @@ bool GenXPrologEpilogInsertion::runOnFunction(Function &F) {
249
256
NumCalls = CallsCalculator ().getNumCalls (F);
250
257
UseGlobalMem =
251
258
F.getParent ()->getModuleFlag (ModuleMD::UseSVMStack) != nullptr ;
259
+ HandleMaskArgs = DefaultMaskArgsProcessingPolicy;
252
260
LLVM_DEBUG (dbgs () << " Visiting all calls in " << F.getName () << " \n " );
253
261
visit (F);
254
262
LLVM_DEBUG (dbgs () << " Visiting finished\n " );
@@ -273,13 +281,21 @@ void GenXPrologEpilogInsertion::visitCallInst(CallInst &I) {
273
281
generateStackCall (&I);
274
282
if (!IsIndirectCall) {
275
283
auto IID = GenXIntrinsic::getAnyIntrinsicID (I.getCalledFunction ());
276
- if (IID == GenXIntrinsic::genx_alloca)
284
+ if (IID == GenXIntrinsic::genx_alloca) {
277
285
generateAlloca (&I);
286
+ return ;
287
+ }
278
288
// TODO: conformance fails when we pass i1 args in presence of SIMDCF. Funny
279
289
// thing is that ISPC doesn't use goto/join in its recursion tests so
280
290
// they're fine (i.e. they're not affected by this option) unlike CM
281
- else if (IID == GenXIntrinsic::genx_simdcf_goto)
291
+ if (IID == GenXIntrinsic::genx_simdcf_goto) {
282
292
HandleMaskArgs = false ;
293
+ DiagnosticInfoPrologEpilogInsertion DiagErr (
294
+ I.getFunction ()->getName () + " : simdcf may not be properly supported" ,
295
+ AbortOnSIMDCF ? DS_Error : DS_Warning);
296
+ I.getContext ().diagnose (DiagErr);
297
+ return ;
298
+ }
283
299
}
284
300
}
285
301
0 commit comments