<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jonas,<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 20, 2015, at 4:03 AM, Jonas Paulsson <<a href="mailto:jonas.paulsson@ericsson.com" class="">jonas.paulsson@ericsson.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    Hi Quentin,<br class="">
    <br class="">
    After Simple Register Coalescing.<br class=""></div></div></blockquote><div><br class=""></div><div>Is the code you have pasted with the PHIs feed to the register coalescer?</div><div>I am trying to understand the setting to help debugging the problem.</div><div>Also, what does -debug-only=regalloc tell you?</div><div><br class=""></div><div>Thanks,</div><div>-Quentin</div><br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    <br class="">
    <tt class="">thanks,<br class="">
      <br class="">
      Jonas<br class="">
    </tt><br class="">
    <div class="moz-cite-prefix">On 2015-04-17 18:52, Quentin Colombet
      wrote:<br class="">
    </div>
    <blockquote cite="mid:21041C84-341E-487A-BA92-23B4AB5AB3E0@apple.com" type="cite" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
      Hi Jonas,
      <div class=""><br class="">
      </div>
      <div class="">When is the MachineVerifier complaining?</div>
      <div class="">I mean after which pass?</div>
      <div class=""><br class="">
      </div>
      <div class="">Thanks,</div>
      <div class="">-Quentin</div>
      <div class=""><br class="">
        <div class="">
          <blockquote type="cite" class="">
            <div class="">On Apr 17, 2015, at 7:17 AM, Jonas Paulsson
              <<a moz-do-not-send="true" href="mailto:jonas.paulsson@ericsson.com" class="">jonas.paulsson@ericsson.com</a>>
              wrote:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <div bgcolor="#FFFFFF" text="#000000" class=""> Hi,<br class="">
                <br class="">
                thanks for answering, but the COPY is there already from
                after isel. It is a copy of a subreg, after a a call
                returning 64 bits.<br class="">
                <br class="">
                    <tt class="">    call
                  <ga:@safe_div_func_uint64_t_u_u></tt><tt class=""><br class="">
                </tt><tt class="">        %vreg45<def> = COPY %r0</tt><tt class=""><br class="">
                </tt><tt class="">        %vreg46<def> = COPY %r1</tt><tt class=""><br class="">
                </tt><tt class="">        %vreg3<def> = COPY
                  %vreg46         
                  <<<<<<<<<<<<<<<<<<</tt><tt class=""><br class="">
                </tt><tt class="">        ST %vreg46, %vreg0</tt><tt class=""><br class="">
                </tt><tt class="">        ST %vreg46, %vreg1</tt><tt class=""><br class="">
                </tt><tt class="">        brr_uncond <BB#4></tt><tt class=""><br class="">
                </tt><br class="">
                Does this ring any bell? Could there be any place that
                misses something about the resulting LiveInterval due to
                a phys reg copy?<br class="">
                <br class="">
                thanks<br class="">
                <br class="">
                /Jonas<br class="">
                <br class="">
                PS Quentin, as I said I could not reproduce this error
                on any in-tree target.<br class="">
              </div>
            </div>
          </blockquote>
          <div class=""><br class="">
          </div>
          <div class="">Ah right.</div>
          <br class="">
          <blockquote type="cite" class="">
            <div class="">
              <div bgcolor="#FFFFFF" text="#000000" class=""> <br class="">
                <br class="">
                <div class="moz-cite-prefix">On 2015-04-17 01:25,
                  Quentin Colombet wrote:<br class="">
                </div>
                <blockquote cite="mid:8FCC1A54-0FFC-4B6E-AB06-3376FDBCB0F5@apple.com" type="cite" class=""> Hi Jonas,
                  <div class=""><br class="">
                  </div>
                  <div class="">Could you file a PR with your test case
                    please?</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">Thanks,</div>
                  <div class="">-Quentin<br class="">
                    <div class="">
                      <blockquote type="cite" class="">
                        <div class="">On Apr 16, 2015, at 3:50 PM,
                          Andrew Trick <<a moz-do-not-send="true" href="mailto:atrick@apple.com" class="">atrick@apple.com</a>>
                          wrote:</div>
                        <br class="Apple-interchange-newline">
                        <div class="">
                          <blockquote type="cite" style="font-family:
                            Helvetica; font-size: 12px; font-style:
                            normal; font-variant: normal; font-weight:
                            normal; letter-spacing: normal; line-height:
                            normal; orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">
                            On Apr 16, 2015, at 6:58 AM, Jonas Paulsson
                            <<a moz-do-not-send="true" href="mailto:jonas.paulsson@ericsson.com" class="">jonas.paulsson@ericsson.com</a>>

                            wrote:<br class="">
                            <br class="">
                            Hi,<br class="">
                            <br class="">
                            I have come across a csmith generated test
                            case that made the MachineVerifier spit out:<br class="">
                            <br class="">
                            *** Bad machine code: Multiple connected
                            components in live interval ***<br class="">
                            <br class="">
                            Having looked at what this might mean, it
                            seems that
                            ConnectedVNInfoEqClasses::Classify() was
                            called on the LI in question by the
                            verifier, and that it returned two
                            equivalence classes, instead of just one,
                            which is demanded by the verifier. Does this
                            mean that there should never be<br class="">
                            any ValNos in a LiveInterval that are not
                            connected? In other words should such an LI
                            never exist, but rather two different LIs?<br class="">
                          </blockquote>
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <span style="font-family: Helvetica;
                            font-size: 12px; font-style: normal;
                            font-variant: normal; font-weight: normal;
                            letter-spacing: normal; line-height: normal;
                            orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class="">That’s
                            right. It looks like a copy was inserted,</span><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <blockquote type="cite" style="font-family:
                            Helvetica; font-size: 12px; font-style:
                            normal; font-variant: normal; font-weight:
                            normal; letter-spacing: normal; line-height:
                            normal; orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">%vreg3<def>

                            = COPY %vreg46<br class="">
                          </blockquote>
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <span style="font-family: Helvetica;
                            font-size: 12px; font-style: normal;
                            font-variant: normal; font-weight: normal;
                            letter-spacing: normal; line-height: normal;
                            orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class="">breaking

                            the live interval, and a new LI was not
                            created. Maybe the splitter did it? You
                            would need to look at debug-only=regalloc.</span><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <span style="font-family: Helvetica;
                            font-size: 12px; font-style: normal;
                            font-variant: normal; font-weight: normal;
                            letter-spacing: normal; line-height: normal;
                            orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class="">Andy</span><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <blockquote type="cite" style="font-family:
                            Helvetica; font-size: 12px; font-style:
                            normal; font-variant: normal; font-weight:
                            normal; letter-spacing: normal; line-height:
                            normal; orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class=""><br class="">
                            I have tried to run this on in-tree targets,
                            but unfortunately they did not reproduce the
                            condition.<br class="">
                            I will therefore try to explain:<br class="">
                            <br class="">
                            The options to llc are -optimize-regalloc
                            -O0. The function is meaningless - with -O3
                            it just returns zero.<br class="">
                            It contains two nested loops, with a call
                            inside the inner loop, which is a
                            CFG-diamond.<br class="">
                            <br class="">
                            The PHI-nodes look like this in the inner
                            loop:<br class="">
                            <br class="">
                            BB#5:  // Inner loop header<br class="">
                             Predecessors according to CFG: BB#1 BB#4<br class="">
                               vreg7<def> = PHI %vreg29,
                            <BB#1>, %vreg4, <BB#4><br class="">
                               ...<br class="">
                             Successors according to CFG: BB#2 BB#6<br class="">
                            <br class="">
                            BB#2:<br class="">
                             Predecessors according to CFG: BB#5<br class="">
                             ...<br class="">
                             Successors according to CFG: BB#3 BB#4<br class="">
                            <br class="">
                            BB#3:<br class="">
                             Predecessors according to CFG: BB#2<br class="">
                               call()<br class="">
                                %vreg46<def> = COPY %return_reg<br class="">
                                %vreg3<def> = COPY %vreg46;<br class="">
                                use of %vreg 46<br class="">
                            <br class="">
                             Successors according to CFG: BB#4<br class="">
                            <br class="">
                            BB#4:<br class="">
                             Predecessors according to CFG: BB#2 BB#3<br class="">
                               %vreg4<def> = PHI %vreg7,
                            <BB#2>, %vreg3, <BB#3><br class="">
                             Successors according to CFG: BB#5<br class="">
                            <br class="">
                            The observation I made here is that %vreg7
                            and %vreg4 are sort of nested PHI nodes,
                            while there are no other users of the
                            registers than the PHI nodes themselves.
                            There is however a use of %vreg46, which
                            later gets coalesced with %vreg64, which
                            will include as well the two PHI nodes.<br class="">
                            <br class="">
                            This is the code with the two equivalence
                            classes, when verifier aborts:<br class="">
                            <br class="">
                            2272B   BB#1: derived from LLVM BB %bb3<br class="">
                                      Predecessors according to CFG:
                            BB#8<br class="">
                            2304B           %vreg64<def> = mov 0<br class="">
                            2448B           jmp <BB#5><br class="">
                                      Successors according to CFG: BB#5<br class="">
                            <br class="">
                            2592B   BB#3: derived from LLVM BB %bb6<br class="">
                                      Predecessors according to CFG:
                            BB#2<br class="">
                            2704B           callr
                            <ga:@safe_div_func_uint64_t_u_u><br class="">
                            2736B           %vreg64<def> = COPY
                            %return_reg<br class="">
                            2768B           use of %vreg64<br class="">
                            2784B           use of %vreg64<br class="">
                            2816B           jmp <BB#4><br class="">
                                      Successors according to CFG: BB#4<br class="">
                            <br class="">
                            *** Bad machine code: Multiple connected
                            components in live interval ***<br class="">
                            - function:    func_61<br class="">
                            - interval:    %vreg64
                            [2304r,2336r:0)[2736r,2784r:3) 0@2304r 1@x
                            2@x 3@2736r<br class="">
                            0: valnos 0<br class="">
                            1: valnos 1 2 3<br class="">
                            LLVM ERROR: Found 1 machine code errors.<br class="">
                            <br class="">
                            Two small live ranges of %vreg64 (originated
                            from %vreg7 and %vreg4), which look ok to
                            me, but the verifier does not like it.<br class="">
                            <br class="">
                            Can anyone give me any background or any
                            hint on what might be the problem here?<br class="">
                            <br class="">
                            thanks,<br class="">
                            <br class="">
                            Jonas Paulsson<br class="">
                            <br class="">
                            <br class="">
_______________________________________________<br class="">
                            LLVM Developers mailing list<br class="">
                            <a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>
                                    <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class="">
                            <a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class="">
                          </blockquote>
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <span style="font-family: Helvetica;
                            font-size: 12px; font-style: normal;
                            font-variant: normal; font-weight: normal;
                            letter-spacing: normal; line-height: normal;
                            orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <span style="font-family: Helvetica;
                            font-size: 12px; font-style: normal;
                            font-variant: normal; font-weight: normal;
                            letter-spacing: normal; line-height: normal;
                            orphans: auto; text-align: start;
                            text-indent: 0px; text-transform: none;
                            white-space: normal; widows: auto;
                            word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class="">LLVM
                            Developers mailing list</span><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">LLVMdev@cs.uiuc.edu</a><span style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px; float: none;
                            display: inline !important;" class=""><span class="Apple-converted-space"> </span>        </span><a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu/" style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">http://llvm.cs.uiuc.edu</a><br style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">
                          <a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" style="font-family: Helvetica; font-size:
                            12px; font-style: normal; font-variant:
                            normal; font-weight: normal; letter-spacing:
                            normal; line-height: normal; orphans: auto;
                            text-align: start; text-indent: 0px;
                            text-transform: none; white-space: normal;
                            widows: auto; word-spacing: 0px;
                            -webkit-text-stroke-width: 0px;" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div>
                      </blockquote>
                    </div>
                    <br class="">
                  </div>
                </blockquote>
                <br class="">
              </div>
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
    </blockquote>
    <br class="">
  </div>

</div></blockquote></div><br class=""></div></body></html>