[llvm-dev] GVN Hoist moving a store across load

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 5 11:07:59 PDT 2016


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


More information about the llvm-dev mailing list