[llvm] r209860 - And fix my fix to sink down through the type at the right time. My

Chandler Carruth chandlerc at gmail.com
Thu May 29 16:21:12 PDT 2014


Author: chandlerc
Date: Thu May 29 18:21:12 2014
New Revision: 209860

URL: http://llvm.org/viewvc/llvm-project?rev=209860&view=rev
Log:
And fix my fix to sink down through the type at the right time. My
original fix would actually trigger the *exact* same crasher as the
original bug for a different reason. Awesomesauce.

Working on test cases now, but wanted to get bots healthier.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=209860&r1=209859&r2=209860&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Thu May 29 18:21:12 2014
@@ -1240,14 +1240,6 @@ Instruction *InstCombiner::visitGetEleme
         if (Op1->getOperand(J)->getType() != Op2->getOperand(J)->getType())
           return nullptr;
 
-        if (J > 1) {
-          if (CompositeType *CT = dyn_cast<CompositeType>(CurTy)) {
-            CurTy = CT->getTypeAtIndex(Op1->getOperand(J));
-          } else {
-            CurTy = nullptr;
-          }
-        }
-
         if (Op1->getOperand(J) != Op2->getOperand(J)) {
           if (DI == -1) {
             // We have not seen any differences yet in the GEPs feeding the
@@ -1270,6 +1262,15 @@ Instruction *InstCombiner::visitGetEleme
             return nullptr;
           }
         }
+
+        // Sink down a layer of the type for the next iteration.
+        if (J > 0) {
+          if (CompositeType *CT = dyn_cast<CompositeType>(CurTy)) {
+            CurTy = CT->getTypeAtIndex(Op1->getOperand(J));
+          } else {
+            CurTy = nullptr;
+          }
+        }
       }
     }
 





More information about the llvm-commits mailing list