blob: 53b36fb3bde0cca575d40252944b9c365140d727 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -verify-machineinstrs -mattr=+multivalue -target-abi=experimental-mv -O2 | FileCheck %s
target triple = "wasm32-unknown-unknown"
; Regression test for #98323 where attempting to stackify the call to `@foo`
; historically led to a miscompile.
define i64 @test() {
; CHECK-LABEL: test:
; CHECK: .functype test () -> (i64)
; CHECK-NEXT: .local i64, i64
; CHECK-NEXT: # %bb.0: # %entry
; CHECK-NEXT: call foo
; CHECK-NEXT: local.set 1
; CHECK-NEXT: local.set 0
; CHECK-NEXT: i64.const 42
; CHECK-NEXT: local.get 1
; CHECK-NEXT: local.get 0
; CHECK-NEXT: i64.eqz
; CHECK-NEXT: i64.select
; CHECK-NEXT: # fallthrough-return
entry:
%pair = call { i64, i64 } @foo()
%v0 = extractvalue { i64, i64 } %pair, 0
%1 = icmp eq i64 %v0, 0
%v1 = extractvalue { i64, i64 } %pair, 1
%_0.sroa.0.0 = select i1 %1, i64 42, i64 %v1
ret i64 %_0.sroa.0.0
}
declare { i64, i64 } @foo()