Skip to content

Commit c02332a

Browse files
committed
[CodeGen] Fix warning in getNode for EXTRACT_SUBVECTOR
Fix a warning in getNode() when extracting a subvector from a concat vector. We can simply replace the call to getVectorNumElements with getVectorMinNumElements as this follows the defined behaviour for EXTRACT_SUBVECTOR. Differential Revision: https://reviews.llvm.org/D82746
1 parent ef7aad0 commit c02332a

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-1
lines changed

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get3.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st3.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// REQUIRES: aarch64-registered-target
12
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
23
// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5+
// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
36

7+
// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8+
// ASM-NOT: warning
49
#include <arm_sve.h>
510

611
#ifdef SVE_OVERLOADED_FORMS

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5566,7 +5566,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
55665566
// the concat have the same type as the extract.
55675567
if (N2C && N1.getOpcode() == ISD::CONCAT_VECTORS &&
55685568
N1.getNumOperands() > 0 && VT == N1.getOperand(0).getValueType()) {
5569-
unsigned Factor = VT.getVectorNumElements();
5569+
unsigned Factor = VT.getVectorMinNumElements();
55705570
return N1.getOperand(N2C->getZExtValue() / Factor);
55715571
}
55725572

0 commit comments

Comments
 (0)