Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126986

Cannot optimize away first instruction in block

XMLWordPrintable

      The first instruction of every block is kept as the label for that block.

      This means that even if it is useless it will not be removed.

      if (a === 0) {
          1 + 1
      }
      

      The content of the if branch gets generate to be this

       9: 14 00 08                 MoveConst C0, r2
      12: 10 01                    LoadInt 1
      14: 80 08                    Add r2, acc
      

      And then optimized to

       9: 14 00 08                 MoveConst C0, r2 

      where the first instruction is kept because it "holds" the label.

       

      This could potentially also prevent detecting empty branches later on.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtqmlteam Qt Qml Team User
            olivier.decanniere Olivier De Cannière
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes