Emit:
  l3_reg109 = l81_this->field0;
Instead of:
  l3_reg109 = l81_this[0u].field0;

where possible


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2579 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 00b00ab..5da8367 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -517,8 +517,19 @@
 void CInstPrintVisitor::printIndexingExpr(MemAccessInst *MAI) {
   CW.writeOperand(MAI->getPointerOperand());
 
-  for (MemAccessInst::op_iterator I = MAI->idx_begin(), E = MAI->idx_end();
-       I != E; ++I)
+  MemAccessInst::op_iterator I = MAI->idx_begin(), E = MAI->idx_end();
+  if (I == E) return;
+
+  // Print out the -> operator if possible...
+  Constant *CI = dyn_cast<Constant>(*I);
+  if (CI && CI->isNullValue() && I+1 != E &&
+      (*(I+1))->getType() == Type::UByteTy) {
+    ++I;
+    Out << "->field" << cast<ConstantUInt>(*I)->getValue();
+    ++I;
+  }
+    
+  for (; I != E; ++I)
     if ((*I)->getType() == Type::UIntTy) {
       Out << "[";
       CW.writeOperand(*I);