forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SystemZ] Assign the full space for promoted and split outgoing args.
When a large "irregular" (e.g. i96) integer call argument is converted to indirect, 64-bit parts are stored to the stack. The full stack space (e.g. i128) was not allocated prior to this patch, but rather just the exact space of the original type. This caused neighboring values on the stack to be overwritten. Thanks to Josh Stone for reporting this. Review: Ulrich Weigand Fixes https://bugs.llvm.org/show_bug.cgi?id=49322 Differential Revision: https://reviews.llvm.org/D97514
- Loading branch information
Showing
2 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; Test outgoing promoted arguments that are split (and passed by reference). | ||
; | ||
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s | ||
|
||
; The i96 arg is promoted to i128 and should get the full stack space. | ||
declare void @fn1(i96) | ||
define i32 @fn2() { | ||
; CHECK-LABEL: fn2: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: stmg %r14, %r15, 112(%r15) | ||
; CHECK-NEXT: .cfi_offset %r14, -48 | ||
; CHECK-NEXT: .cfi_offset %r15, -40 | ||
; CHECK-NEXT: aghi %r15, -184 | ||
; CHECK-NEXT: .cfi_def_cfa_offset 344 | ||
; CHECK-NEXT: mvhi 180(%r15), -1 | ||
; CHECK-NEXT: mvghi 168(%r15), 0 | ||
; CHECK-NEXT: la %r2, 160(%r15) | ||
; CHECK-NEXT: mvghi 160(%r15), 0 | ||
; CHECK-NEXT: brasl %r14, fn1@PLT | ||
; CHECK-NEXT: l %r2, 180(%r15) | ||
; CHECK-NEXT: lmg %r14, %r15, 296(%r15) | ||
; CHECK-NEXT: br %r14 | ||
%1 = alloca i32 | ||
store i32 -1, i32* %1 | ||
call void @fn1(i96 0) | ||
%2 = load i32, i32* %1 | ||
ret i32 %2 | ||
} | ||
|
||
declare void @fn3(i136) | ||
define i32 @fn4() { | ||
; CHECK-LABEL: fn4: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: stmg %r14, %r15, 112(%r15) | ||
; CHECK-NEXT: .cfi_offset %r14, -48 | ||
; CHECK-NEXT: .cfi_offset %r15, -40 | ||
; CHECK-NEXT: aghi %r15, -192 | ||
; CHECK-NEXT: .cfi_def_cfa_offset 352 | ||
; CHECK-NEXT: mvhi 188(%r15), -1 | ||
; CHECK-NEXT: mvghi 176(%r15), 0 | ||
; CHECK-NEXT: mvghi 168(%r15), 0 | ||
; CHECK-NEXT: la %r2, 160(%r15) | ||
; CHECK-NEXT: mvghi 160(%r15), 0 | ||
; CHECK-NEXT: brasl %r14, fn3@PLT | ||
; CHECK-NEXT: l %r2, 188(%r15) | ||
; CHECK-NEXT: lmg %r14, %r15, 304(%r15) | ||
; CHECK-NEXT: br %r14 | ||
%1 = alloca i32 | ||
store i32 -1, i32* %1 | ||
call void @fn3(i136 0) | ||
%2 = load i32, i32* %1 | ||
ret i32 %2 | ||
} |