diff options
author | Dan Gohman <dan433584@gmail.com> | 2016-04-26 01:40:56 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2016-04-26 01:40:56 +0000 |
commit | f456290fca06b368c2b6ab07ef29af2193c403e8 (patch) | |
tree | 3f9c52c90b364874e7c1d9b680b3ac6799ec132a | |
parent | 2bcc9ad88c05a8008750e8e5d95c629664f09f51 (diff) | |
download | bcm5719-llvm-f456290fca06b368c2b6ab07ef29af2193c403e8.tar.gz bcm5719-llvm-f456290fca06b368c2b6ab07ef29af2193c403e8.zip |
[WebAssembly] Account for implicit operands when computing operand indices.
llvm-svn: 267511
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/irreducible-cfg.ll | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp index 65e79d4765d..5dc90920e31 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp @@ -204,7 +204,7 @@ bool WebAssemblyFixIrreducibleControlFlow::VisitLoop(MachineFunction &MF, if (!Pair.second) continue; - unsigned Index = MIB.getInstr()->getNumOperands() - 1; + unsigned Index = MIB.getInstr()->getNumExplicitOperands() - 1; DEBUG(dbgs() << "MBB#" << MBB->getNumber() << " has index " << Index << "\n"); diff --git a/llvm/test/CodeGen/WebAssembly/irreducible-cfg.ll b/llvm/test/CodeGen/WebAssembly/irreducible-cfg.ll index 5226f176cd1..8fe7d10c5f3 100644 --- a/llvm/test/CodeGen/WebAssembly/irreducible-cfg.ll +++ b/llvm/test/CodeGen/WebAssembly/irreducible-cfg.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s +; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement | FileCheck %s ; Test irreducible CFG handling. @@ -8,6 +8,9 @@ target triple = "wasm32-unknown-unknown" ; A simple loop with two entries. ; CHECK-LABEL: test0: +; CHECK: f64.load +; CHECK: i32.const $[[REG:[^,]+]]=, 0{{$}} +; CHECK: br_table $[[REG]], define void @test0(double* %arg, i32 %arg1, i32 %arg2, i32 %arg3) { bb: %tmp = icmp eq i32 %arg2, 0 @@ -46,6 +49,9 @@ bb19: ; A simple loop with two entries and an inner natural loop. ; CHECK-LABEL: test1: +; CHECK: f64.load +; CHECK: i32.const $[[REG:[^,]+]]=, 0{{$}} +; CHECK: br_table $[[REG]], define void @test1(double* %arg, i32 %arg1, i32 %arg2, i32 %arg3) { bb: %tmp = icmp eq i32 %arg2, 0 |