summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-11-18 20:05:18 +0000
committerDuncan Sands <baldrick@free.fr>2010-11-18 20:05:18 +0000
commitdcfd3a798ffbd5e02d4892eeef562c9124598844 (patch)
tree7a9a91a019d76abf51392d3906a62b7a3ec74922 /test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
parentd0c6f3dafd7c3e9137d4e6415014c94137fcd3fc (diff)
downloadllvm-dcfd3a798ffbd5e02d4892eeef562c9124598844.tar.gz
llvm-dcfd3a798ffbd5e02d4892eeef562c9124598844.tar.bz2
llvm-dcfd3a798ffbd5e02d4892eeef562c9124598844.tar.xz
The DAGCombiner was threading select over pairs of extending loads even
if the extension types were not the same. The result was that if you fed a select with sext and zext loads, as in the testcase, then it would get turned into a zext (or sext) of the select, which is wrong in the cases when it should have been an sext (resp. zext). Reported and diagnosed by Sebastien Deldon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2010-11-18-SelectOfExtload.ll')
-rw-r--r--test/CodeGen/X86/2010-11-18-SelectOfExtload.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll b/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
new file mode 100644
index 0000000000..a1074b6b8f
--- /dev/null
+++ b/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=x86 | FileCheck %s
+; Both values were being zero extended.
+@u = external global i8
+@s = external global i8
+define i32 @foo(i1 %cond) {
+; CHECK: @foo
+ %u_base = load i8* @u
+ %u_val = zext i8 %u_base to i32
+; CHECK: movzbl
+; CHECK: movsbl
+ %s_base = load i8* @s
+ %s_val = sext i8 %s_base to i32
+ %val = select i1 %cond, i32 %u_val, i32 %s_val
+ ret i32 %val
+}