[llvm-commits] [llvm] r56947 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp

Dan Gohman gohman at apple.com
Thu Oct 2 07:56:13 PDT 2008


Author: djg
Date: Thu Oct  2 09:56:12 2008
New Revision: 56947

URL: http://llvm.org/viewvc/llvm-project?rev=56947&view=rev
Log:
Work around an interaction between fast-isel and regalloc=local. The
local register allocator's physreg liveness doesn't recognize subregs,
so it doesn't know that defs of %ecx that are immediately followed by
uses of %cl aren't dead. This comes up due to the way fast-isel emits
shift instructions.

This is a temporary workaround. Arguably, local regalloc should
handle subreg references correctly. On the other hand, perhaps
fast-isel should use INSERT_SUBREG instead of just assigning to the
most convenient super-register of %cl when lowering shifts.

This fixes MultiSource/Benchmarks/MallocBench/espresso,
MultiSource/Applications/hexxagon, and others, under -fast.

Modified:
    llvm/trunk/lib/Target/X86/X86FastISel.cpp

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56947&r1=56946&r2=56947&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Oct  2 09:56:12 2008
@@ -741,7 +741,11 @@
   if (Op1Reg == 0) return false;
   TII.copyRegToReg(*MBB, MBB->end(), CReg, Op1Reg, RC, RC);
   unsigned ResultReg = createResultReg(RC);
-  BuildMI(MBB, TII.get(OpReg), ResultReg).addReg(Op0Reg);
+  BuildMI(MBB, TII.get(OpReg), ResultReg).addReg(Op0Reg)
+    // FIXME: The "Local" register allocator's physreg liveness doesn't
+    // recognize subregs. Adding the superreg of CL that's actually defined
+    // prevents it from being re-allocated for this instruction.
+    .addReg(CReg, false, true);
   UpdateValueMap(I, ResultReg);
   return true;
 }





More information about the llvm-commits mailing list