[PATCH] D43544: [Transforms][SROA] Fixed assertion crash (PR30416)
Konstantin Belochapka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 19:35:21 PST 2018
kbelochapka created this revision.
kbelochapka added reviewers: luqmana, rafael.
Problem:
In certain situations during ALLOCA promotion, the promoteSingleBlockAlloca() function attempts to replace an instruction by itself. This causes the assertion crash described in PR30416.
Solution:
Disable SROA for a Basic Block that can cause circular dependency.
https://reviews.llvm.org/D43544
Files:
lib/Transforms/Utils/PromoteMemoryToRegister.cpp
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.135188.patch
Type: text/x-patch
Size: 477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180221/d457ad84/attachment.bin>
More information about the llvm-commits
mailing list