Skip to content

Commit 90dc72d

Browse files
committed
Minor revisions.
1 parent ed920b7 commit 90dc72d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -869,18 +869,16 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToVector(AllocaInst &Alloca) {
869869
}
870870

871871
unsigned ElementSizeInBits = DL->getTypeSizeInBits(ElemTy);
872-
if (ElementSizeInBits == 0) {
873-
LLVM_DEBUG(dbgs() << " Cannot create vector of zero-sized elements.");
874-
return false;
875-
}
876872
if (ElementSizeInBits != DL->getTypeAllocSizeInBits(ElemTy)) {
877873
LLVM_DEBUG(dbgs() << " Cannot convert to vector if the allocation size "
878874
"does not match the type's size\n");
879875
return false;
880876
}
881877
unsigned ElementSize = ElementSizeInBits / 8;
882-
if (ElementSize == 0)
878+
if (ElementSize == 0) {
879+
LLVM_DEBUG(dbgs() << " Cannot create vector of zero-sized elements\n");
883880
return false;
881+
}
884882

885883
// Calculate the size of the corresponding vector, accounting for padding of
886884
// inner types, e.g., odd-sized subvectors. Storage size of new vector must
@@ -889,11 +887,12 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToVector(AllocaInst &Alloca) {
889887
unsigned AllocaSize = DL->getTypeStoreSize(AllocaTy);
890888
unsigned NumElems = AllocaSize / ElementSize;
891889
if (NumElems == 0) {
892-
LLVM_DEBUG(dbgs() << " Cannot vectorize an empty aggregate type.");
890+
LLVM_DEBUG(dbgs() << " Cannot vectorize an empty aggregate type\n");
893891
return false;
894892
}
895893
if (NumElems * ElementSize != AllocaSize) {
896-
LLVM_DEBUG(dbgs() << " Cannot convert type into vector of the same size.");
894+
LLVM_DEBUG(
895+
dbgs() << " Cannot convert type into vector of the same size\n");
897896
return false;
898897
}
899898
auto *VectorTy = FixedVectorType::get(ElemTy, NumElems);

llvm/test/CodeGen/AMDGPU/promote-alloca-structs.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2-
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-promote-alloca-to-vector -amdgpu-promote-alloca-to-vector-limit=512 -amdgpu-promote-alloca-to-vector-max-regs=32 %s | FileCheck %s
2+
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-promote-alloca-to-vector -amdgpu-promote-alloca-to-vector-limit=512 %s | FileCheck %s
33

44
declare void @clobber_i8(i8)
55

0 commit comments

Comments
 (0)