[llvm] d154d0a - [NFC] Simplify code
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 08:16:05 PDT 2022
Author: Guillaume Chatelet
Date: 2022-06-20T15:15:52Z
New Revision: d154d0ac064b6f65c66bb9d5b2b75972a4b2aeb8
URL: https://github.com/llvm/llvm-project/commit/d154d0ac064b6f65c66bb9d5b2b75972a4b2aeb8
DIFF: https://github.com/llvm/llvm-project/commit/d154d0ac064b6f65c66bb9d5b2b75972a4b2aeb8.diff
LOG: [NFC] Simplify code
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
index f6eecf4e250e..fd812eb676ef 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
@@ -518,9 +518,8 @@ bool AMDGPUCallLowering::lowerFormalArgumentsKernel(
if (AllocSize == 0)
continue;
- MaybeAlign ABIAlign = IsByRef ? Arg.getParamAlign() : None;
- if (!ABIAlign)
- ABIAlign = DL.getABITypeAlign(ArgTy);
+ MaybeAlign ParamAlign = IsByRef ? Arg.getParamAlign() : None;
+ Align ABIAlign = DL.getValueOrABITypeAlignment(ParamAlign, ArgTy);
uint64_t ArgOffset = alignTo(ExplicitArgOffset, ABIAlign) + BaseOffset;
ExplicitArgOffset = alignTo(ExplicitArgOffset, ABIAlign) + AllocSize;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
index 4519d2a1c7bd..2e5c35f1f571 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
@@ -92,9 +92,8 @@ bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
for (Argument &Arg : F.args()) {
const bool IsByRef = Arg.hasByRefAttr();
Type *ArgTy = IsByRef ? Arg.getParamByRefType() : Arg.getType();
- MaybeAlign ABITypeAlign = IsByRef ? Arg.getParamAlign() : None;
- if (!ABITypeAlign)
- ABITypeAlign = DL.getABITypeAlign(ArgTy);
+ MaybeAlign ParamAlign = IsByRef ? Arg.getParamAlign() : None;
+ Align ABITypeAlign = DL.getValueOrABITypeAlignment(ParamAlign, ArgTy);
uint64_t Size = DL.getTypeSizeInBits(ArgTy);
uint64_t AllocSize = DL.getTypeAllocSize(ArgTy);
More information about the llvm-commits
mailing list