summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-03-16 22:20:18 +0000
committerCameron Zwarich <zwarich@apple.com>2011-03-16 22:20:18 +0000
commitebe8173941238cfbabadb1c63bca7fb7dcf2adbe (patch)
treee26ad4384575e2b10d06cd5476abbe4d91724ada /test
parent7be4b7ed75d0e094d2cb1998a3d4a8d346b5d839 (diff)
downloadllvm-ebe8173941238cfbabadb1c63bca7fb7dcf2adbe.tar.gz
llvm-ebe8173941238cfbabadb1c63bca7fb7dcf2adbe.tar.bz2
llvm-ebe8173941238cfbabadb1c63bca7fb7dcf2adbe.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/bool-zext.ll18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/CodeGen/X86/bool-zext.ll b/test/CodeGen/X86/bool-zext.ll
index 67168d4bf0..d2c30c64f2 100644
--- a/test/CodeGen/X86/bool-zext.ll
+++ b/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()