RemoveNeverExecutedCode

Deneau, Tom tom.deneau at amd.com
Thu Aug 21 23:39:07 UTC 2014


I am trying to benchmark an HSAIL kernel that is implementing the following lambda
     n -> {
       if (a1[n] != a2[n]) {
         isEqual = false;
      }

where a1 and a2 are arrays of doubles.   So it is basically doing an Arrays.equals.

I set up the test to have 2,000,000 elements in the arrays and one of them does not match.
Before I compile for HSAIL, I enable some profiling by running the above lambda on the cpu in non-parallel mode (IntStream.range().forEach()) so the lambda gets executed 2000000 times (and takes the false branch once).

But even though one of the elements does not match, when I compile thru graal with the default -G:+RemoveNeverExecutedCode, I see that the isEqual = false path has been considered "not executed" and has been removed.

Is taking a branch once out of 2,000,000 times considered "not executed"?
Or is there some other flaw here?

Of course I can work around this  in this case by forcing -G:-RemoveNeverExecutedCode but I'd like to understand this.
This is running in -server mode.

-- Tom



More information about the graal-dev mailing list