GithubHelp home page GithubHelp logo

Comments (4)

pshipton avatar pshipton commented on May 29, 2024

@hzongaro fyi

from openj9.

hzongaro avatar hzongaro commented on May 29, 2024

Opt index 148 appears to be General Loop Unroller, in this case. @BradleyWood, may I ask you to take a look at this problem?

from openj9.

BradleyWood avatar BradleyWood commented on May 29, 2024

GLU decided to unroll the do-while loop by a factor of 4 without residual. During unrolling, the body (block_3) got cloned 3 times, dropping if (3 > e) return and rewrote the control flow such that block_3 is the last of the unrolled sequence to execute.

n3n       BBStart <block_3> (freq 10000)                                                      [0x7f32a92af980] bci=[-1,24,9] rc=0 vc=855 vn=- li=- udi=- nc=0
n26n      lstorei  Test.a J[#428  notAccessed Shadow +8] [flags 0x604 0x0 ]                   [0x7f32a92b00b0] bci=[-1,33,9] rc=0 vc=859 vn=- li=- udi=- nc=2
n22n        aload  <'this' parm LTest;>[#422  Parm] [flags 0x40000107 0x0 ] (X!=0 X>=0 )      [0x7f32a92aff70] bci=[-1,24,9] rc=1 vc=859 vn=- li=- udi=12 nc=0 flg=0x104
n25n        lsub                                                                              [0x7f32a92b0060] bci=[-1,32,9] rc=2 vc=859 vn=- li=- udi=- nc=2
n23n          lload  <temp slot 7>[#445  Auto] [flags 0x4 0x0 ] (cannotOverflow createdByPRE )  [0x7f32a92affc0] bci=[-1,26,9] rc=1 vc=859 vn=- li=- udi=13 nc=0 flg=0x41000
n24n          lconst -2 (X!=0 X<=0 )                                                          [0x7f32a92b0010] bci=[-1,29,9] rc=1 vc=859 vn=- li=- udi=- nc=0 flg=0x204
n237n     lstore  <temp slot 7>[#445  Auto] [flags 0x4 0x0 ]                                  [0x7f32a934e9d0] bci=[-1,32,9] rc=0 vc=859 vn=- li=6 udi=3 nc=1
n25n        ==>lsub
n33n      ificmplt --> block_4 BBStart at n31n (swappedChildren )                             [0x7f32a92b02e0] bci=[-1,40,10] rc=0 vc=859 vn=- li=- udi=- nc=2 flg=0x20020
n27n        iload  <auto slot 2>[#424  Auto] [flags 0x3 0x0 ] (cannotOverflow )               [0x7f32a92b0100] bci=[-1,36,10] rc=1 vc=859 vn=- li=- udi=14 nc=0 flg=0x1000
n29n        iconst 3 (X!=0 X>=0 )                                                             [0x7f32a92b01a0] bci=[-1,38,10] rc=1 vc=859 vn=- li=- udi=- nc=0 flg=0x104
n4n       BBEnd </block_3> =====   

block_28, clone of block_3

n309n     BBStart <block_28> (freq 10000)                                                     [0x7f32a9350050] bci=[-1,24,9] rc=0 vc=855 vn=- li=- udi=- nc=0
n310n     lstorei  Test.a J[#428  notAccessed Shadow +8] [flags 0x604 0x0 ]                   [0x7f32a93500a0] bci=[-1,33,9] rc=0 vc=859 vn=- li=- udi=- nc=2
n311n       aload  <'this' parm LTest;>[#422  Parm] [flags 0x40000107 0x0 ] (X!=0 X>=0 )      [0x7f32a93500f0] bci=[-1,24,9] rc=1 vc=859 vn=- li=- udi=12 nc=0 flg=0x104
n312n       lsub                                                                              [0x7f32a9350140] bci=[-1,32,9] rc=2 vc=859 vn=- li=- udi=- nc=2
n313n         lload  <temp slot 7>[#445  Auto] [flags 0x4 0x0 ] (cannotOverflow createdByPRE )  [0x7f32a9350190] bci=[-1,26,9] rc=1 vc=859 vn=- li=- udi=13 nc=0 flg=0x41000
n314n         lconst -2 (X!=0 X<=0 )                                                          [0x7f32a93501e0] bci=[-1,29,9] rc=1 vc=859 vn=- li=- udi=- nc=0 flg=0x204
n315n     lstore  <temp slot 7>[#445  Auto] [flags 0x4 0x0 ]                                  [0x7f32a9350230] bci=[-1,32,9] rc=0 vc=859 vn=- li=6 udi=3 nc=1
n312n       ==>lsub
n319n     BBEnd </block_28> =====                                                             [0x7f32a9350370] bci=[-1,40,10] rc=0 vc=855 vn=- li=- udi=- nc=0

So I think the loop got rewritten from:

int d = -9;
...
do {
  a += 2;
  for (e = d; 3 > e;)
    return;
} while (++d < 1000);

to something like:

int d = -9;
...
do {
  a += 2;
  a += 2;
  a += 2;
  a += 2;
  for (e = d; 3 > e;)
    return;
} while (++d < 1000);

from openj9.

BradleyWood avatar BradleyWood commented on May 29, 2024

So I think what happened is that unrolling attempted to remove the loop-back branch for each of the new unrolled blocks but accidentally removed the comparison of the inner-loop.

from openj9.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.