From 0e03f9e9cecf388df2e3d19139be0a9faca63672 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Mar 2014 19:04:42 -0800 Subject: Disable the LowerExpectIntrinsic pass. --- lib/Transforms/NaCl/PNaClABISimplify.cpp | 2 ++ test/CodeGen/JS/expect-intrinsics.ll | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/CodeGen/JS/expect-intrinsics.ll diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp index a78bf3ef40..5678ffaa7f 100644 --- a/lib/Transforms/NaCl/PNaClABISimplify.cpp +++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp @@ -60,7 +60,9 @@ void llvm::PNaClABISimplifyAddPreOptPasses(PassManager &PM) { // LowerExpect converts Intrinsic::expect into branch weights, // which can then be removed after BlockPlacement. +#if 0 // XXX EMSCRIPTEN: We support the expect intrinsic. PM.add(createLowerExpectIntrinsicPass()); +#endif #if 0 // XXX EMSCRIPTEN: We don't need this. // Rewrite unsupported intrinsics to simpler and portable constructs. PM.add(createRewriteLLVMIntrinsicsPass()); diff --git a/test/CodeGen/JS/expect-intrinsics.ll b/test/CodeGen/JS/expect-intrinsics.ll new file mode 100644 index 0000000000..b061f52967 --- /dev/null +++ b/test/CodeGen/JS/expect-intrinsics.ll @@ -0,0 +1,26 @@ +; RUN: llc -march=js < %s | FileCheck %s + +; Handle the llvm.expect intrinsic. + +; CHECK: $expval = $x; +; CHECK: $tobool = ($expval|0)!=(0); +define void @foo(i32 %x) { +entry: + %expval = call i32 @llvm.expect.i32(i32 %x, i32 0) + %tobool = icmp ne i32 %expval, 0 + br i1 %tobool, label %if.then, label %if.end + +if.then: + call void @callee() + br label %if.end + +if.end: + ret void +} + +; Function Attrs: nounwind readnone +declare i32 @llvm.expect.i32(i32, i32) #0 + +declare void @callee() + +attributes #0 = { nounwind readnone } -- cgit v1.2.3-18-g5258