Krzysztof Parzyszek via llvm-dev
2016-Aug-05 18:07 UTC
[llvm-dev] GVN Hoist moving a store across load
Hi, I have a scenario, roughly like this: if (...) { ... = *x *x = 0 } else { ... = *x *x = 0 } The two sides are functionally different, but both load some value and then set it to 0. After GVN Hoist, I get: *x = 0 if (...) { ... = *x } else { ... = *x } That is, the store was hoisted above the loads. The code is not exactly public, so I can't just attach it as a testcase, but it seems like some simple check is missing somewhere. Does this ring a bell? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Kevin Choi via llvm-dev
2016-Aug-05 18:40 UTC
[llvm-dev] GVN Hoist moving a store across load
Is the aliasing correct? Check the LHS type with type of x to see that they are properly aliased. -Kevin On 5 August 2016 at 11:07, Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I have a scenario, roughly like this: > > if (...) { > ... = *x > *x = 0 > } else { > ... = *x > *x = 0 > } > > The two sides are functionally different, but both load some value and > then set it to 0. > > After GVN Hoist, I get: > > *x = 0 > if (...) { > ... = *x > } else { > ... = *x > } > > That is, the store was hoisted above the loads. > > The code is not exactly public, so I can't just attach it as a testcase, > but it seems like some simple check is missing somewhere. > > Does this ring a bell? > > -Krzysztof > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160805/eb008df4/attachment.html>
Krzysztof Parzyszek via llvm-dev
2016-Aug-05 20:19 UTC
[llvm-dev] GVN Hoist moving a store across load
Opened https://llvm.org/bugs/show_bug.cgi?id=28874 for this. -Krzysztof On 8/5/2016 1:07 PM, Krzysztof Parzyszek via llvm-dev wrote:> Hi, > > I have a scenario, roughly like this: > > if (...) { > ... = *x > *x = 0 > } else { > ... = *x > *x = 0 > } > > The two sides are functionally different, but both load some value and > then set it to 0. > > After GVN Hoist, I get: > > *x = 0 > if (...) { > ... = *x > } else { > ... = *x > } > > That is, the store was hoisted above the loads. > > The code is not exactly public, so I can't just attach it as a testcase, > but it seems like some simple check is missing somewhere. > > Does this ring a bell? > > -Krzysztof >-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Daniel Berlin via llvm-dev
2016-Aug-05 20:49 UTC
[llvm-dev] GVN Hoist moving a store across load
>From what i can tell (just diffing before/after) , this is caused by thesame iterator bug and should be fixed in a moment by https://reviews.llvm.org/D23187 On Fri, Aug 5, 2016 at 1:19 PM, Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Opened https://llvm.org/bugs/show_bug.cgi?id=28874 for this. > > -Krzysztof > > > > On 8/5/2016 1:07 PM, Krzysztof Parzyszek via llvm-dev wrote: > >> Hi, >> >> I have a scenario, roughly like this: >> >> if (...) { >> ... = *x >> *x = 0 >> } else { >> ... = *x >> *x = 0 >> } >> >> The two sides are functionally different, but both load some value and >> then set it to 0. >> >> After GVN Hoist, I get: >> >> *x = 0 >> if (...) { >> ... = *x >> } else { >> ... = *x >> } >> >> That is, the store was hoisted above the loads. >> >> The code is not exactly public, so I can't just attach it as a testcase, >> but it seems like some simple check is missing somewhere. >> >> Does this ring a bell? >> >> -Krzysztof >> >> > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160805/03ee882d/attachment.html>