File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -413,20 +413,27 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
413413 if (isKernel)
414414 continue ;
415415
416+ // OptNone builtins are special versions of builtins assuring that all
417+ // theirs parameters are constant values.
418+ if (isOptNoneBuiltin (F->getName ()))
419+ {
420+ // OptimizeNone attribute was only required to prevent clang optimizations.
421+ // We can remove it now to unblock IGC optimizations.
422+ F->removeFnAttr (llvm::Attribute::OptimizeNone);
423+ // Treat optnone builtins as stackcalls to avoid kernel bloat.
424+ pCtx->m_enableStackCall = true ;
425+ F->addFnAttr (" visaStackCall" );
426+ continue ;
427+ }
428+
416429 // Flag for function calls where alwaysinline must be true
417430 bool mustAlwaysInline = false ;
418431
419432 // Add always attribtue if function is a builtin
420433 if (F->hasFnAttribute (llvm::Attribute::Builtin) ||
421434 F->getName ().startswith (spv::kLLVMName ::builtinPrefix))
422435 {
423- if (isOptNoneBuiltin (F->getName ()))
424- {
425- pCtx->m_enableStackCall = true ;
426- F->addFnAttr (" visaStackCall" );
427- }
428- else
429- mustAlwaysInline = true ;
436+ mustAlwaysInline = true ;
430437 }
431438 // inline all OCL math functions if __FastRelaxedMath is set
432439 else if (fastMathFunct.find (F) != fastMathFunct.end ())
You can’t perform that action at this time.
0 commit comments