[llvm] r239309 - X86: Reject register operands with obvious type mismatches.
Matthias Braun
matze at braunis.de
Mon Jun 8 09:56:24 PDT 2015
Author: matze
Date: Mon Jun 8 11:56:23 2015
New Revision: 239309
URL: http://llvm.org/viewvc/llvm-project?rev=239309&view=rev
Log:
X86: Reject register operands with obvious type mismatches.
While we have some code to transform specification like {ax} into
{eax}/{rax} if the operand type isn't 16bit, we should reject cases
where there is no sane way to do this, like the i128 type in the
example.
Related to rdar://21042280
Differential Revision: http://reviews.llvm.org/D10260
Added:
llvm/trunk/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=239309&r1=239308&r2=239309&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 8 11:56:23 2015
@@ -25517,6 +25517,10 @@ X86TargetLowering::getRegForInlineAsmCon
Res.first = DestReg;
Res.second = &X86::GR64RegClass;
}
+ } else if (VT != MVT::Other) {
+ // Type mismatch and not a clobber: Return an error;
+ Res.first = 0;
+ Res.second = nullptr;
}
} else if (Res.second == &X86::FR32RegClass ||
Res.second == &X86::FR64RegClass ||
@@ -25542,6 +25546,15 @@ X86TargetLowering::getRegForInlineAsmCon
Res.second = &X86::VR256RegClass;
else if (X86::VR512RegClass.hasType(VT))
Res.second = &X86::VR512RegClass;
+ else if (VT != MVT::Other) {
+ // Type mismatch and not a clobber: Return an error;
+ Res.first = 0;
+ Res.second = nullptr;
+ }
+ } else if (VT != MVT::Other) {
+ // Type mismatch and not a clobber: Return an error;
+ Res.first = 0;
+ Res.second = nullptr;
}
return Res;
Added: llvm/trunk/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll?rev=239309&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll (added)
+++ llvm/trunk/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll Mon Jun 8 11:56:23 2015
@@ -0,0 +1,10 @@
+; RUN: not llc -no-integrated-as %s -o - 2> %t1
+; RUN: FileCheck %s < %t1
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64--"
+
+; CHECK: error: couldn't allocate output register for constraint '{ax}'
+define i128 @blup() {
+ %v = tail call i128 asm "", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i128 0)
+ ret i128 %v
+}
More information about the llvm-commits
mailing list