Skip to content

Commit aa1a694

Browse files
[LLVM][GlobalISel] Make CSEMIRBuilder::buildConstant scalable vector aware. (#158299)
1 parent c6c60e1 commit aa1a694

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ MachineInstrBuilder CSEMIRBuilder::buildConstant(const DstOp &Res,
339339

340340
// For vectors, CSE the element only for now.
341341
LLT Ty = Res.getLLTTy(*getMRI());
342-
if (Ty.isVector())
342+
if (Ty.isFixedVector())
343343
return buildSplatBuildVector(Res, buildConstant(Ty.getElementType(), Val));
344+
if (Ty.isScalableVector())
345+
return buildSplatVector(Res, buildConstant(Ty.getElementType(), Val));
344346

345347
FoldingSetNodeID ID;
346348
GISelInstProfileBuilder ProfBuilder(ID, *getMRI());

llvm/test/CodeGen/AArch64/GlobalISel/select-splat-vector.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
22
; RUN: llc < %s -mtriple aarch64 -mattr=+sve -aarch64-enable-gisel-sve=1 | FileCheck %s --check-prefixes=CHECK,CHECK-SDAG
3+
; RUN: llc < %s -mtriple aarch64 -mattr=+sve -aarch64-enable-gisel-sve=1 -use-constant-int-for-scalable-splat | FileCheck %s --check-prefixes=CHECK,CHECK-SDAG
34
; RUN: llc < %s -mtriple aarch64 -mattr=+sve -global-isel -aarch64-enable-gisel-sve=1 | FileCheck %s --check-prefixes=CHECK,CHECK-GS
4-
5-
; REQUIRES: asserts
5+
; RUN: llc < %s -mtriple aarch64 -mattr=+sve -global-isel -aarch64-enable-gisel-sve=1 -use-constant-int-for-scalable-splat | FileCheck %s --check-prefixes=CHECK,CHECK-GS
66

77
;; add
88
define <vscale x 2 x i64> @addnxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {

0 commit comments

Comments
 (0)