File tree 2 files changed +19
-3
lines changed 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -5038,7 +5038,9 @@ bool NVPTXTargetLowering::getTgtMemIntrinsic(
5038
5038
// / ensures that alignment is 16 or greater.
5039
5039
Align NVPTXTargetLowering::getFunctionParamOptimizedAlign (
5040
5040
const Function *F, Type *ArgTy, const DataLayout &DL) const {
5041
- const uint64_t ABITypeAlign = DL.getABITypeAlign (ArgTy).value ();
5041
+ // Capping the alignment to 128 bytes as that is the maximum alignment
5042
+ // supported by PTX.
5043
+ const Align ABITypeAlign = std::min (Align (128 ), DL.getABITypeAlign (ArgTy));
5042
5044
5043
5045
// If a function has linkage different from internal or private, we
5044
5046
// must use default ABI alignment as external users rely on it. Same
@@ -5048,10 +5050,10 @@ Align NVPTXTargetLowering::getFunctionParamOptimizedAlign(
5048
5050
/* IgnoreCallbackUses=*/ false ,
5049
5051
/* IgnoreAssumeLikeCalls=*/ true ,
5050
5052
/* IgnoreLLVMUsed=*/ true ))
5051
- return Align ( ABITypeAlign) ;
5053
+ return ABITypeAlign;
5052
5054
5053
5055
assert (!isKernelFunction (*F) && " Expect kernels to have non-local linkage" );
5054
- return Align ( std::max (uint64_t (16 ), ABITypeAlign) );
5056
+ return std::max (Align (16 ), ABITypeAlign);
5055
5057
}
5056
5058
5057
5059
// / Helper for computing alignment of a device function byval parameter.
Original file line number Diff line number Diff line change
1
+ ; RUN: llc < %s -march=nvptx64 -O0 | FileCheck %s
2
+ ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -O0 | %ptxas-verify %}
3
+
4
+
5
+ ; CHECK: .visible .func (.param .align 128 .b8 func_retval0[256]) repro()
6
+ define <64 x i32 > @repro () {
7
+
8
+ ; CHECK: .param .align 128 .b8 retval0[256];
9
+ %1 = tail call <64 x i32 > @test (i32 0 )
10
+ ret <64 x i32 > %1
11
+ }
12
+
13
+ ; Function Attrs: nounwind
14
+ declare <64 x i32 > @test (i32 )
You can’t perform that action at this time.
0 commit comments