Consider the following C program:
#include <stdio.h>
#include <unistd.h>
static int
correct_optind(int argc, char **argv)
{
int option;
optind = 1;
opterr = 0;
while ((option = getopt(argc, argv, "v")) != -1)
;
return optind;
}
int
main(int argc, char **argv)
{
int correct = correct_optind(argc, argv);
printf("correct optind: %d (argv[%d] is the first non-option)\n",
correct, correct);
return 0;
}
which is compiled with: -JAAAndersenRegionAware -JStoreValueForwarding -JLoadChainSeparation -JNodeReduction
Here is a graph from directly before the LoadChainSeparation pass:
The load node after the loop has memory state dependency to the loop, as the loop contains a call to the external function getopt()
Here is the same graph directly after the LoadChainSeparation pass:
The load node has all in a sudden no memory state edge dependency towards the loop any longer. If the IOBarrier would be removed now (which is legal to do), then the load would be independent of the theta node and therefore could be scheduled before it. This is incorrect.
optind.zip
Consider the following C program:
which is compiled with:
-JAAAndersenRegionAware -JStoreValueForwarding -JLoadChainSeparation -JNodeReductionHere is a graph from directly before the LoadChainSeparation pass:
The load node after the loop has memory state dependency to the loop, as the loop contains a call to the external function
getopt()Here is the same graph directly after the LoadChainSeparation pass:
The load node has all in a sudden no memory state edge dependency towards the loop any longer. If the IOBarrier would be removed now (which is legal to do), then the load would be independent of the theta node and therefore could be scheduled before it. This is incorrect.
optind.zip