[PATCH] Fix Bug in SROA transformation [PR18615]

Duncan P. N. Exon Smith dexonsmith at apple.com
Sat Feb 15 18:35:57 PST 2014


On 2014 Feb 12, at 21:17, Karthik Bhat <kv.bhat at samsung.com> wrote:

> 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.");
> <D2759.1.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Testcase?



More information about the llvm-commits mailing list