]> granicus.if.org Git - llvm/commitdiff
Improve the efficiency and cleanup writing a bit
authorChris Lattner <sabre@nondot.org>
Wed, 16 Apr 2003 20:20:02 +0000 (20:20 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Apr 2003 20:20:02 +0000 (20:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5782 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index b3f8db7c423284a7f41d7c975268c320f1d720f4..958980bad678c624631f6606da476430f2cf3b9c 100644 (file)
@@ -804,20 +804,22 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
     bool PrintAllTypes = false;
     const Type *TheType = Operand->getType();
 
-    for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) {
-      Operand = I.getOperand(i);
-      if (Operand->getType() != TheType) {
-       PrintAllTypes = true;       // We have differing types!  Print them all!
-       break;
+    // Shift Left & Right print both types even for Ubyte LHS
+    if (isa<ShiftInst>(I)) {
+      PrintAllTypes = true;
+    } else {
+      for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) {
+        Operand = I.getOperand(i);
+        if (Operand->getType() != TheType) {
+          PrintAllTypes = true;    // We have differing types!  Print them all!
+          break;
+        }
       }
     }
-
-    // Shift Left & Right print both types even for Ubyte LHS
-    if (isa<ShiftInst>(I)) PrintAllTypes = true;
-
+    
     if (!PrintAllTypes) {
       Out << " ";
-      printType(I.getOperand(0)->getType());
+      printType(TheType);
     }
 
     for (unsigned i = 0, E = I.getNumOperands(); i != E; ++i) {