[PATCH] D43544: [Transforms][SROA] Fixed assertion crash (PR30416)

Konstantin Belochapka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 14:49:54 PST 2018


kbelochapka updated this revision to Diff 135521.
kbelochapka edited the summary of this revision.

https://reviews.llvm.org/D43544

Files:
  lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  test/Transforms/SROA/pr30416.ll


Index: test/Transforms/SROA/pr30416.ll
===================================================================
--- test/Transforms/SROA/pr30416.ll
+++ test/Transforms/SROA/pr30416.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -sroa -S | FileCheck %s
+target triple = "x86_64-pc-linux"
+
+; Make sure that SROA optimization is disabled on basic block 
+; starting from label CF423.
+;CHECK-LABEL:	CF423
+;CHECK-NEXT:	store <4 x i64> %A4.0.load, <4 x i64>* undef, align 32
+;CHECK-NEXT:	A4.0.load = load <4 x i64>, <4 x i64>* undef, align 32
+;CHECK-NEXT:	store <4 x i64> zeroinitializer, <4 x i64>* undef, align 32
+;CHECK-NEXT:	br label %CF423
+
+define void @autogen_SD998899922() {
+CF419:
+  %A4 = alloca <4 x i64>, align 32
+  br label %CF434
+CF434:
+  br label %CF434
+CF423:
+  store <4 x i64> %L38, <4 x i64>* %A4, align 32
+  %L38 = load <4 x i64>, <4 x i64>* %A4, align 32
+  store <4 x i64> zeroinitializer, <4 x i64>* %A4, align 32
+  br label %CF423
+}
+
Index: lib/Transforms/Utils/PromoteMemoryToRegister.cpp
===================================================================
--- lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -509,6 +509,9 @@
           !isKnownNonZero(ReplVal, DL, 0, AC, LI, &DT))
         addAssumeNonNull(AC, LI);
 
+      // we have a loop, bail out
+      if (LI == ReplVal)
+        return false;
       LI->replaceAllUsesWith(ReplVal);
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43544.135521.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180222/169592bc/attachment.bin>


More information about the llvm-commits mailing list