Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created July 2, 2018 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/2baf6f95f00275858c8b81d6eff25327 to your computer and use it in GitHub Desktop.
Save alexcrichton/2baf6f95f00275858c8b81d6eff25327 to your computer and use it in GitHub Desktop.
; ModuleID = 'foo0-8787f43e282added376259c1adb08b80.rs'
source_filename = "foo0-8787f43e282added376259c1adb08b80.rs"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
; Function Attrs: nounwind
define void @test() unnamed_addr #0 {
start:
%0 = call i32 @return_one()
br label %bb1
bb1: ; preds = %start
%1 = icmp eq i32 %0, 1
%2 = xor i1 %1, true
br i1 %2, label %bb2, label %bb3
bb2: ; preds = %bb1
call void @panic()
unreachable
bb3: ; preds = %bb1
%3 = xor i1 %2, true
br i1 %3, label %bb4, label %bb5
bb4: ; preds = %bb3
call void @panic()
unreachable
bb5: ; preds = %bb3
ret void
}
; Function Attrs: nounwind
declare i32 @return_one() unnamed_addr #0
; Function Attrs: noreturn nounwind
declare void @panic() unnamed_addr #1
attributes #0 = { nounwind }
attributes #1 = { noreturn nounwind }
extern {
fn return_one() -> u32;
fn panic() -> !;
}
#[no_mangle]
pub unsafe extern fn test() {
let tmp: bool = !(return_one() == 1);
if tmp { panic() }
if !tmp { panic() }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment