- Loading...
...
...
...
Loop
...
Predication
...
is
...
an
...
optimization
...
in
...
C2.
...
The
...
general
...
idea
...
is
...
to
...
insert
...
a
...
predicate
...
on
...
the
...
entry
...
path
...
to
...
a
...
loop,
...
and
...
raise
...
a
...
uncommon
...
trap
...
if
...
the
...
check
...
of
...
the
...
condition
...
fails.
...
The
...
condition
...
checks
...
are
...
promoted
...
from
...
inside
...
the
...
loop
...
body,
...
and
...
thus
...
the
...
checks
...
inside
...
the
...
loop
...
could
...
be
...
eliminated.
...
Currently,
...
loop
...
predication
...
optimization
...
has
...
been
...
applied
...
to
...
remove
...
array
...
range
...
check,
...
null
...
checks
...
and
...
array
...
checks
...
in
...
loops.
...
Use loop predicate to remove array range checks in a loop.
original loop |
for (int i = init, i < limit; i += stride) |
...
{ |
...
// loop |
...
with |
...
array |
...
range |
...
check |
...
+ |
...
offset |
...
< |
...
a.length) |
...
{ // array range check |
...
] |
...
... |
...
|
...
|
...
|
after loop predication |
|---|
if ( scale * imax + offset < a.length ) |
...
{ // loop predicate |
...
i < limit; i += stride) |
...
{ |
...
/ |
...
/ loop |
...
without |
...
array range |
...
check |