This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

eliminate dead stores across functions


Hi,
For the following test-case,

int a;

__attribute__((noinline))
static void foo()
{
  a = 3;
}

int main()
{
  a = 4;
  foo ();
  return a;
}

I assume it's safe to remove "a = 4"  since 'a' would be overwritten
by call to foo ?
IIUC, ipa-reference pass does mod/ref analysis to compute side-effects
of function call,
so could we perhaps use ipa_reference_get_not_written_global() in dse
pass to check if a global variable will be killed on call to a
function ? If not, I suppose we could write a similar ipa pass that
computes the set of killed global variables per function but I am not
sure if that's the correct approach.

Thanks,
Prathamesh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]