[X86][ISel] Fix a regression I introduced in r224884
authorKeno Fischer <kfischer@college.harvard.edu>
Sun, 28 Dec 2014 15:20:57 +0000 (15:20 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Sun, 28 Dec 2014 15:20:57 +0000 (15:20 +0000)
The else case ResultReg was not checked for validity.
To my surprise, this case was not hit in any of the
existing test cases. This includes a new test cases
that tests this path.

Also drop the `target triple` declaration from the
original test as suggested by H.J. Lu, because
apparently with it the test won't be run on Linux

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224901 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FastISel.cpp
test/CodeGen/X86/fast-isel-call-bool.ll
test/CodeGen/X86/large-code-model-isel.ll [new file with mode: 0644]

index 4af856c5622242eb7e5a0dd72daf5c8a9edda832..d4459eec8ba5c4a6b57fd5895db5f75f4852cb70 100644 (file)
@@ -2709,15 +2709,15 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) {
 
       ResultReg =
         fastEmit_ri(VT, VT, ISD::AND, ResultReg, hasTrivialKill(PrevVal), 1);
-
-      if (!ResultReg)
-        return false;
     } else {
       if (!isTypeLegal(Val->getType(), VT))
         return false;
       ResultReg = getRegForValue(Val);
     }
 
+    if (!ResultReg)
+      return false;
+
     ArgRegs.push_back(ResultReg);
     OutVTs.push_back(VT);
   }
index 44db38c5ea9a2f2e95a6e39cff12171ecc2ca01e..876b02275c61ab0eae1ae76c2630ce668838d9e0 100644 (file)
@@ -1,8 +1,7 @@
-; RUN: llc < %s -fast-isel -mcpu=core2 -O1 | FileCheck %s
+; RUN: llc < %s -fast-isel -mcpu=core2 -march=x86-64 -O1 | FileCheck %s
 ; See PR21557
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-darwin14.0.0"
 
 declare i64 @bar(i1)
 
diff --git a/test/CodeGen/X86/large-code-model-isel.ll b/test/CodeGen/X86/large-code-model-isel.ll
new file mode 100644 (file)
index 0000000..3c283d9
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: llc < %s -code-model=large -mcpu=core2 -march=x86-64 -O0 | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+@.str10 = external unnamed_addr constant [2 x i8], align 1
+
+define void @foo() {
+; CHECK-LABEL: foo:
+entry:
+; CHECK: callq
+  %call = call i64* undef(i64* undef, i8* getelementptr inbounds ([2 x i8]* @.str10, i32 0, i32 0))
+  ret void
+}