From 00897e9b7b88f0435565909480021803c21ca3b7 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 25 Oct 2018 05:04:35 +0000 Subject: [PATCH] [CodeGen] Always emit the 'min-legal-vector-width' attribute even when the value is 0. The X86 backend will need to see the attribute to make decisions. If it isn't present the backend will have to assume large vectors may be present. llvm-svn: 345237 --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 +--- clang/test/CodeGen/aarch64-neon-ldst-one.c | 2 +- clang/test/CodeGen/aarch64-poly64.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 41bde79abab3..700723189ed1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -448,9 +448,7 @@ 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. - if (LargestVectorWidth != 0) - CurFn->addFnAttr("min-legal-vector-width", - llvm::utostr(LargestVectorWidth)); + CurFn->addFnAttr("min-legal-vector-width", llvm::utostr(LargestVectorWidth)); } /// ShouldInstrumentFunction - Return true if the current function should be diff --git a/clang/test/CodeGen/aarch64-neon-ldst-one.c b/clang/test/CodeGen/aarch64-neon-ldst-one.c index 97ded9a59666..0d20982408cf 100644 --- a/clang/test/CodeGen/aarch64-neon-ldst-one.c +++ b/clang/test/CodeGen/aarch64-neon-ldst-one.c @@ -6800,4 +6800,4 @@ void test_vst4_lane_p64(poly64_t *a, poly64x1x4_t b) { // CHECK: attributes #0 ={{.*}}"min-legal-vector-width"="128" // CHECK: attributes #1 ={{.*}}"min-legal-vector-width"="64" -// CHECK-NOT: attributes #2 ={{.*}}"min-legal-vector-width" +// CHECK: attributes #2 ={{.*}}"min-legal-vector-width"="0" diff --git a/clang/test/CodeGen/aarch64-poly64.c b/clang/test/CodeGen/aarch64-poly64.c index 53493033c286..cdf91699c9b0 100644 --- a/clang/test/CodeGen/aarch64-poly64.c +++ b/clang/test/CodeGen/aarch64-poly64.c @@ -614,4 +614,4 @@ poly64x2_t test_vsriq_n_p64(poly64x2_t a, poly64x2_t b) { // CHECK: attributes #0 ={{.*}}"min-legal-vector-width"="64" // CHECK: attributes #1 ={{.*}}"min-legal-vector-width"="128" -// CHECK-NOT: attributes #2 ={{.*}}"min-legal-vector-width" +// CHECK: attributes #2 ={{.*}}"min-legal-vector-width"="0" -- 2.34.1