diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-03-16 22:20:18 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-03-16 22:20:18 +0000 |
commit | ac106273d4ff77d259a63e82771aec29ca11ec1a (patch) | |
tree | f5739f4fc3624d1cf9b5c27adc9ce0e8c5c5861f /llvm/test/CodeGen | |
parent | 40a9200357099c7ef0480abb5a135239a83bfb35 (diff) | |
download | bcm5719-llvm-ac106273d4ff77d259a63e82771aec29ca11ec1a.tar.gz bcm5719-llvm-ac106273d4ff77d259a63e82771aec29ca11ec1a.zip |
The x86-64 ABI says that a bool is only guaranteed to be sign-extended to a byte
rather than an int. Thankfully, this only causes LLVM to miss optimizations, not
generate incorrect code.
This just fixes the zext at the return. We still insert an i32 ZextAssert when
reading a function's arguments, but it is followed by a truncate and another i8
ZextAssert so it is not optimized.
llvm-svn: 127766
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/X86/bool-zext.ll | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/X86/bool-zext.ll b/llvm/test/CodeGen/X86/bool-zext.ll index 67168d4bf04..d2c30c64f23 100644 --- a/llvm/test/CodeGen/X86/bool-zext.ll +++ b/llvm/test/CodeGen/X86/bool-zext.ll @@ -6,7 +6,7 @@ define void @bar1(i1 zeroext %v1) nounwind ssp { entry: %conv = zext i1 %v1 to i32 - %call = tail call i32 (...)* @foo(i32 %conv) nounwind + %call = tail call i32 (...)* @foo1(i32 %conv) nounwind ret void } @@ -16,8 +16,20 @@ entry: define void @bar2(i8 zeroext %v1) nounwind ssp { entry: %conv = zext i8 %v1 to i32 - %call = tail call i32 (...)* @foo(i32 %conv) nounwind + %call = tail call i32 (...)* @foo1(i32 %conv) nounwind ret void } -declare i32 @foo(...) +; CHECK: @bar3 +; CHECK: callq +; CHECK-NOT: movzbl +; CHECK-NOT: and +; CHECK: ret +define zeroext i1 @bar3() nounwind ssp { +entry: + %call = call i1 @foo2() nounwind + ret i1 %call +} + +declare i32 @foo1(...) +declare zeroext i1 @foo2() |