Skip to content

Commit 68f1391

Browse files
committed
[ScalarizeMaskedMemIntrin] Use poison instead of undef as placeholder [NFC]
This is used for masked out lanes, that are replaced with the passthrough value
1 parent 4592543 commit 68f1391

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static unsigned adjustForEndian(const DataLayout &DL, unsigned VectorWidth,
125125
// br label %else
126126
//
127127
// else: ; preds = %0, %cond.load
128-
// %res.phi.else = phi <16 x i32> [ %5, %cond.load ], [ undef, %0 ]
128+
// %res.phi.else = phi <16 x i32> [ %5, %cond.load ], [ poison, %0 ]
129129
// %6 = extractelement <16 x i1> %mask, i32 1
130130
// br i1 %6, label %cond.load1, label %else2
131131
//
@@ -386,11 +386,11 @@ static void scalarizeMaskedStore(const DataLayout &DL, CallInst *CI,
386386
// cond.load:
387387
// %Ptr0 = extractelement <16 x i32*> %Ptrs, i32 0
388388
// %Load0 = load i32, i32* %Ptr0, align 4
389-
// %Res0 = insertelement <16 x i32> undef, i32 %Load0, i32 0
389+
// %Res0 = insertelement <16 x i32> poison, i32 %Load0, i32 0
390390
// br label %else
391391
//
392392
// else:
393-
// %res.phi.else = phi <16 x i32>[%Res0, %cond.load], [undef, %0]
393+
// %res.phi.else = phi <16 x i32>[%Res0, %cond.load], [poison, %0]
394394
// %Mask1 = extractelement <16 x i1> %Mask, i32 1
395395
// br i1 %Mask1, label %cond.load1, label %else2
396396
//
@@ -645,7 +645,7 @@ static void scalarizeMaskedExpandLoad(const DataLayout &DL, CallInst *CI,
645645
Value *VResult = PassThru;
646646

647647
// Shorten the way if the mask is a vector of constants.
648-
// Create a build_vector pattern, with loads/undefs as necessary and then
648+
// Create a build_vector pattern, with loads/poisons as necessary and then
649649
// shuffle blend with the pass through value.
650650
if (isConstantIntVector(Mask)) {
651651
unsigned MemIndex = 0;
@@ -654,7 +654,7 @@ static void scalarizeMaskedExpandLoad(const DataLayout &DL, CallInst *CI,
654654
for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
655655
Value *InsertElt;
656656
if (cast<Constant>(Mask)->getAggregateElement(Idx)->isNullValue()) {
657-
InsertElt = UndefValue::get(EltTy);
657+
InsertElt = PoisonValue::get(EltTy);
658658
ShuffleMask[Idx] = Idx + VectorWidth;
659659
} else {
660660
Value *NewPtr =

llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-expandload.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define <2 x i64> @scalarize_v2i64_ones_mask(ptr %p, <2 x i64> %passthru) {
4747

4848
define <2 x i64> @scalarize_v2i64_zero_mask(ptr %p, <2 x i64> %passthru) {
4949
; CHECK-LABEL: @scalarize_v2i64_zero_mask(
50-
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i64> undef, <2 x i64> [[PASSTHRU:%.*]], <2 x i32> <i32 2, i32 3>
50+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i64> poison, <2 x i64> [[PASSTHRU:%.*]], <2 x i32> <i32 2, i32 3>
5151
; CHECK-NEXT: ret <2 x i64> [[TMP1]]
5252
;
5353
%ret = call <2 x i64> @llvm.masked.expandload.v2i64.p0(ptr %p, <2 x i1> <i1 false, i1 false>, <2 x i64> %passthru)
@@ -58,7 +58,7 @@ define <2 x i64> @scalarize_v2i64_const_mask(ptr %p, <2 x i64> %passthru) {
5858
; CHECK-LABEL: @scalarize_v2i64_const_mask(
5959
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i64, ptr [[P:%.*]], i32 0
6060
; CHECK-NEXT: [[LOAD1:%.*]] = load i64, ptr [[TMP1]], align 1
61-
; CHECK-NEXT: [[RES1:%.*]] = insertelement <2 x i64> <i64 undef, i64 poison>, i64 [[LOAD1]], i64 1
61+
; CHECK-NEXT: [[RES1:%.*]] = insertelement <2 x i64> poison, i64 [[LOAD1]], i64 1
6262
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i64> [[RES1]], <2 x i64> [[PASSTHRU:%.*]], <2 x i32> <i32 2, i32 1>
6363
; CHECK-NEXT: ret <2 x i64> [[TMP2]]
6464
;

0 commit comments

Comments
 (0)