aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp3
-rw-r--r--test/CodeGen/X86/crash.ll11
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index c1d66cb570..91cec98946 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -1913,6 +1913,9 @@ bool X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
else if (SrcRC->hasSuperClass(&X86::GR32RegClass) &&
DestRC->hasSuperClass(&X86::GR32RegClass))
CommonRC = &X86::GR32RegClass;
+ else if (SrcRC->hasSuperClass(&X86::GR8RegClass) &&
+ DestRC->hasSuperClass(&X86::GR8RegClass))
+ CommonRC = &X86::GR8RegClass;
else
CommonRC = 0;
}
diff --git a/test/CodeGen/X86/crash.ll b/test/CodeGen/X86/crash.ll
index 2f27f35f0a..a14a48baa3 100644
--- a/test/CodeGen/X86/crash.ll
+++ b/test/CodeGen/X86/crash.ll
@@ -130,3 +130,14 @@ bb14:
bb67:
ret void
}
+
+; Crash when trying to copy AH to AL.
+; PR7540
+define void @copy8bitregs() nounwind {
+entry:
+ %div.i = sdiv i32 115200, 0
+ %shr8.i = lshr i32 %div.i, 8
+ %conv4.i = trunc i32 %shr8.i to i8
+ call void asm sideeffect "outb $0, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i8 %conv4.i, i32 1017) nounwind
+ unreachable
+}