summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-05-08 18:29:42 +0000
committerPete Cooper <peter_cooper@apple.com>2015-05-08 18:29:42 +0000
commit7f7c9f1dad9364c97eb43ac649c5fffd6d4f7dbd (patch)
tree6704e7ed5221aa546d2906364ee237724b0adaf2 /llvm/lib/Target
parent396441c8734d083ff70bdd866f3305f38fef35a9 (diff)
downloadbcm5719-llvm-7f7c9f1dad9364c97eb43ac649c5fffd6d4f7dbd.tar.gz
bcm5719-llvm-7f7c9f1dad9364c97eb43ac649c5fffd6d4f7dbd.zip
[X86] Fast-ISel was incorrectly always killing the source of a truncate.
A trunc from i32 to i1 on x86_64 generates an instruction such as %vreg19<def> = COPY %vreg9:sub_8bit<kill>; GR8:%vreg19 GR32:%vreg9 However, the copy here should only have the kill flag on the 32-bit path, not the 64-bit one. Otherwise, we are killing the source of the truncate which could be used later in the program. llvm-svn: 236890
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index 9d817164b05..3bf4fb824fd 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -2185,6 +2185,7 @@ bool X86FastISel::X86SelectTrunc(const Instruction *I) {
return true;
}
+ bool KillInputReg = false;
if (!Subtarget->is64Bit()) {
// If we're on x86-32; we can't extract an i8 from a general register.
// First issue a copy to GR16_ABCD or GR32_ABCD.
@@ -2194,11 +2195,12 @@ bool X86FastISel::X86SelectTrunc(const Instruction *I) {
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(TargetOpcode::COPY), CopyReg).addReg(InputReg);
InputReg = CopyReg;
+ KillInputReg = true;
}
// Issue an extract_subreg.
unsigned ResultReg = fastEmitInst_extractsubreg(MVT::i8,
- InputReg, /*Kill=*/true,
+ InputReg, KillInputReg,
X86::sub_8bit);
if (!ResultReg)
return false;
OpenPOWER on IntegriCloud