fix ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll
authorChris Lattner <sabre@nondot.org>
Mon, 19 Mar 2007 18:25:57 +0000 (18:25 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 19 Mar 2007 18:25:57 +0000 (18:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35169 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ScalarReplAggregates.cpp

index 880e8df72c55e0873047a78ecc3c6c86625332e1..a26fcbefe810ff5716715e2111727117a5a54c97 100644 (file)
@@ -661,7 +661,8 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) {
   // up.
   for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
        UI != E; ) {
-    GetElementPtrInst *GEPI = cast<GetElementPtrInst>(*UI++);
+    GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(*UI++);
+    if (!GEPI) continue;
     gep_type_iterator I = gep_type_begin(GEPI);
     ++I;