[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp

Nate Begeman natebegeman at mac.com
Sat Nov 20 21:23:18 PST 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.107 -> 1.108
---
Log message:

Fix Shootout-C++/wc, which was broken by my recent changes to emit fewer
reg-reg copies.  The necessary conditions for this bug are a GEP that is
used outside the basic block in which it is defined, whose components
other than the pointer are all constant zero, and where the use is
selected before the definition (backwards branch to successsor block).


---
Diffs of the changes:  (+6 -5)

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.107 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.108
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.107	Fri Nov 19 02:01:16 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Sat Nov 20 23:14:06 2004
@@ -3835,18 +3835,19 @@
   unsigned TargetReg = getReg(GEPI, MBB, IP);
   unsigned basePtrReg = getReg(Src, MBB, IP);
 
-  if ((indexReg == 0) && remainder->isNullValue())
-    RegMap[GEPI] = basePtrReg;
-
+  if ((indexReg == 0) && remainder->isNullValue()) {
+    BuildMI(*MBB, IP, PPC::OR, 2, TargetReg).addReg(basePtrReg)
+      .addReg(basePtrReg);
+    return;
+  }
   if (!remainder->isNullValue()) {
     unsigned TmpReg = (indexReg == 0) ? TargetReg : makeAnotherReg(Type::IntTy);
     emitBinaryConstOperation(MBB, IP, basePtrReg, remainder, 0, TmpReg);
     basePtrReg = TmpReg;
   }
-  if (indexReg != 0) { 
+  if (indexReg != 0)
     BuildMI(*MBB, IP, PPC::ADD, 2, TargetReg).addReg(indexReg)
       .addReg(basePtrReg);
-  }
 }
 
 /// visitAllocaInst - If this is a fixed size alloca, allocate space from the






More information about the llvm-commits mailing list