[llvm-commits] [llvm] r132676 - in /llvm/trunk: lib/CodeGen/SelectionDAG/FastISel.cpp test/CodeGen/X86/fast-isel-agg-constant.ll

Eli Friedman eli.friedman at gmail.com
Sun Jun 5 22:46:34 PDT 2011


Author: efriedma
Date: Mon Jun  6 00:46:34 2011
New Revision: 132676

URL: http://llvm.org/viewvc/llvm-project?rev=132676&view=rev
Log:
PR10077: fix fast-isel of extractvalue of aggregate constants.


Added:
    llvm/trunk/test/CodeGen/X86/fast-isel-agg-constant.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=132676&r1=132675&r2=132676&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Jun  6 00:46:34 2011
@@ -841,8 +841,10 @@
   DenseMap<const Value *, unsigned>::iterator I = FuncInfo.ValueMap.find(Op0);
   if (I != FuncInfo.ValueMap.end())
     ResultReg = I->second;
-  else
+  else if (isa<Instruction>(Op0))
     ResultReg = FuncInfo.InitializeRegForValue(Op0);
+  else
+    return false; // fast-isel can't handle aggregate constants at the moment
 
   // Get the actual result register, which is an offset from the base register.
   unsigned VTIndex = ComputeLinearIndex(AggTy, EVI->idx_begin(), EVI->idx_end());

Added: llvm/trunk/test/CodeGen/X86/fast-isel-agg-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-agg-constant.ll?rev=132676&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel-agg-constant.ll (added)
+++ llvm/trunk/test/CodeGen/X86/fast-isel-agg-constant.ll Mon Jun  6 00:46:34 2011
@@ -0,0 +1,11 @@
+; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s
+; Make sure fast-isel doesn't screw up aggregate constants.
+; (Failing out is okay, as long as we don't miscompile.)
+
+%bar = type { i32 }
+
+define i32 @foo()  {
+  %tmp = extractvalue %bar { i32 3 }, 0
+  ret i32 %tmp
+; CHECK: movl $3, %eax
+}





More information about the llvm-commits mailing list