[PATCH] Fix Bug in SROA transformation [PR18615]
Karthik Bhat
kv.bhat at samsung.com
Wed Feb 12 21:17:00 PST 2014
Hi chandlerc,
Hi All,
There seems to be a bug in SROA Transformation of llvm resulting in PR18615.
The bug seems to be that in function visitMemTransferInst if we have failed in insertUse and mark the instruction as dead we should return from visitMemTransferInst instead of checking if we ended up with a valid index in the map.
Added a check which checks if insertUse failed then return from visitMemTransferInst.
I'm a bit new to llvm optimization it would be great if someone can help review this patch for me.
Thanks
Karthik Bhat
http://llvm-reviews.chandlerc.com/D2759
Files:
lib/Transforms/Scalar/SROA.cpp
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -524,6 +524,10 @@
// Insert the use now that we've fixed up the splittable nature.
insertUse(II, Offset, Size, /*IsSplittable=*/Inserted && Length);
+ //If the insert resulted in marking the instruction as dead
+ //i.e. we didn't end up pushing the usage into map then return
+ if (VisitedDeadInsts.count(&II))
+ return;
// Check that we ended up with a valid index in the map.
assert(S.Slices[PrevIdx].getUse()->getUser() == &II &&
"Map index doesn't point back to a slice with this user.");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2759.1.patch
Type: text/x-patch
Size: 720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140212/6273e03a/attachment.bin>
More information about the llvm-commits
mailing list