From e746a9a600a0f697009820eb6acf8eff65853f0f Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 21 Dec 2022 11:39:11 +0800 Subject: [Clang] Emit "min-legal-vector-width" attribute for X86 only This is an alternative way of D139627 suggested by Craig. Creently only X86 backend uses this attribute. Let's just emit for X86 only. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D139701 --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 874a083..a8d9b81 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -499,7 +499,9 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // 4. Width of vector arguments and return types for this function. // 5. Width of vector aguments and return types for functions called by this // function. - CurFn->addFnAttr("min-legal-vector-width", llvm::utostr(LargestVectorWidth)); + if (getContext().getTargetInfo().getTriple().isX86()) + CurFn->addFnAttr("min-legal-vector-width", + llvm::utostr(LargestVectorWidth)); // Add vscale_range attribute if appropriate. Optional> VScaleRange = -- cgit v1.1