[WebAssembly] Account for implicit operands when computing operand indices.

llvm-svn: 267511
This commit is contained in:
Dan Gohman
2016-04-26 01:40:56 +00:00
parent 2bcc9ad88c
commit f456290fca
2 changed files with 8 additions and 2 deletions

View File

@@ -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");

View File

@@ -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