James Y Knight | 2e64b8b | 2016-10-25 22:13:28 +0000 | [diff] [blame] | 1 | ;; Sparc backend can't currently handle variable allocas with |
| 2 | ;; alignment greater than the stack alignment. This code ought to |
| 3 | ;; compile, but doesn't currently. |
| 4 | |
| 5 | ;; RUN: not llc -march=sparc < %s 2>&1 | FileCheck %s |
| 6 | ;; RUN: not llc -march=sparcv9 < %s 2>&1 | FileCheck %s |
| 7 | ;; CHECK: ERROR: Function {{.*}} required stack re-alignment |
| 8 | |
| 9 | define void @variable_alloca_with_overalignment(i32 %num) { |
| 10 | %aligned = alloca i32, align 64 |
| 11 | %var_size = alloca i8, i32 %num, align 4 |
| 12 | call void @foo(i32* %aligned, i8* %var_size) |
| 13 | ret void |
| 14 | } |
| 15 | |
| 16 | ;; Same but with the alloca itself overaligned |
| 17 | define void @variable_alloca_with_overalignment_2(i32 %num) { |
| 18 | %var_size = alloca i8, i32 %num, align 64 |
| 19 | call void @foo(i32* null, i8* %var_size) |
| 20 | ret void |
| 21 | } |
| 22 | |
| 23 | declare void @foo(i32*, i8*); |