Created
July 2, 2018 16:11
-
-
Save alexcrichton/2baf6f95f00275858c8b81d6eff25327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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