Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscompile with multivalue ABI #98323

Open
nikic opened this issue Jul 10, 2024 · 3 comments
Open

Miscompile with multivalue ABI #98323

nikic opened this issue Jul 10, 2024 · 3 comments
Labels

Comments

@nikic
Copy link
Contributor

nikic commented Jul 10, 2024

From rust-lang/rust#127318:

; RUN: llc -mtriple=wasm32-unknown-unknown -target-abi=experimental-mv
define i64 @test() {
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()

Results in:

	i64.const	42
	local.get	0
	call	foo
	local.set	0
	i64.eqz
	i64.select

Note the get-before-set of local 0.

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2024

@llvm/issue-subscribers-backend-webassembly

Author: Nikita Popov (nikic)

From https://github.com/rust-lang/rust/issues/127318:
; RUN: llc -mtriple=wasm32-unknown-unknown -target-abi=experimental-mv
define i64 @<!-- -->test() {
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()

Results in:

	i64.const	42
	local.get	0
	call	foo
	local.set	0
	i64.eqz
	i64.select

Note the get-before-set of local 0.

@EugeneZelenko EugeneZelenko added the ABI Application Binary Interface label Jul 10, 2024
@temeddix
Copy link

temeddix commented Sep 20, 2024

Is there any update on this issue? This bug is kind of severe, as any feature that use multivalue ABI like u128 leads to maximum call stack error.

This affect many features including:

@tlively
Copy link
Collaborator

tlively commented Sep 24, 2024

Can you work around the issue by not using multivalue for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants