diff options
author | Derek Schuff <dschuff@google.com> | 2016-02-16 18:18:36 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-02-16 18:18:36 +0000 |
commit | aadc89c25d664d8c52b7a96b1db1d581cd435358 (patch) | |
tree | 1bcfd5585267ea813c4d88d9ef15b04dbb5d5659 /llvm/test | |
parent | cc4c8718ed09b783a03f93500b96aea41f8273b4 (diff) | |
download | bcm5719-llvm-aadc89c25d664d8c52b7a96b1db1d581cd435358.tar.gz bcm5719-llvm-aadc89c25d664d8c52b7a96b1db1d581cd435358.zip |
[WebAssembly] Insert COPY_LOCAL between CopyToReg and FrameIndex DAG nodes
CopyToReg nodes don't support FrameIndex operands. Other targets select
the FI to some LEA-like instruction, but since we don't have that, we
need to insert some kind of instruction that can take an FI operand and
produces a value usable by CopyToReg (i.e. in a vreg). So insert a dummy
copy_local between Op and its FI operand. This results in a redundant
copy which we should optimize away later (maybe in the post-FI-lowering
peephole pass).
Differential Revision: http://reviews.llvm.org/D17213
llvm-svn: 260987
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/userstack.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/userstack.ll b/llvm/test/CodeGen/WebAssembly/userstack.ll index 435e1dd0b84..b5e711f6efb 100644 --- a/llvm/test/CodeGen/WebAssembly/userstack.ll +++ b/llvm/test/CodeGen/WebAssembly/userstack.ll @@ -160,4 +160,25 @@ define void @dynamic_static_alloca(i32 %alloc) { ret void } +; The use of the alloca in a phi causes a CopyToReg DAG node to be generated, +; which has to have special handling because CopyToReg can't have a FI operand +; CHECK-LABEL: copytoreg_fi: +define void @copytoreg_fi(i1 %cond, i32* %b) { +entry: + ; CHECK: i32.const [[L2:.+]]=, 16 + ; CHECK-NEXT: i32.sub [[SP:.+]]=, {{.+}}, [[L2]] + %addr = alloca i32 + ; CHECK: i32.const [[OFF:.+]]=, 12 + ; CHECK-NEXT: i32.add [[ADDR:.+]]=, [[SP]], [[OFF]] + ; CHECK-NEXT: copy_local [[COPY:.+]]=, [[ADDR]] + br label %body +body: + %a = phi i32* [%addr, %entry], [%b, %body] + store i32 1, i32* %a + ; CHECK: i32.store {{.*}}, 0([[COPY]]), + br i1 %cond, label %body, label %exit +exit: + ret void +} + ; TODO: test over-aligned alloca |