<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 07/07/2014 09:47 PM, deadal nix
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANGV3T2MtKwXGQeH6V8ntk_3wjwvXBhnwL+EAfQxn9caBsY8QA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">
        <div>OK from what I understand, the DAG.getSExtOrTrunc(SetCC,
          DL, SelectVT) is unecessary and the SelectVT is nto the right
          type (as it is called with incorrect parameter).<br>
          <br>
        </div>
        Here is a patch so it won't generate a loop. I ran make check
        and it doesn't look like anything is broken.<br>
      </div>
    </blockquote>
    No, it is necessary and is the fundamental change in that commit.
    SelectVT is not necessarily the same as VT, so it needs to be
    converted. This patch breaks the testcases I have that this fixed.
    If it helps, this is the testcase I was fixing.<br>
    <br>
    define i32 @test_sext_icmp_i64(i64 %arg) {<br>
      %x = icmp eq i64 %arg, 0<br>
      %y = sext i1 %x to i32<br>
      ret i32 %y<br>
    }<br>
    <br>
    The setcc type is i64 for the i64 icmp, so it then needs to be
    truncated to 32-bits in this situation<br>
    <br>
    <br>
    <blockquote
cite="mid:CANGV3T2MtKwXGQeH6V8ntk_3wjwvXBhnwL+EAfQxn9caBsY8QA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2014-07-07 11:36 GMT-07:00 Matt
          Arsenault <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:arsenm2@gmail.com" target="_blank">arsenm2@gmail.com</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class=""><br>
              On Jul 5, 2014, at 7:14 PM, deadal nix <<a
                moz-do-not-send="true" href="mailto:deadalnix@gmail.com">deadalnix@gmail.com</a>>
              wrote:<br>
              <br>
              > OK, so in you case, you want
              DAG.getSExtOrTrunc(SetCC, DL, SelectVT) to tunc the result
              from i64 to i32 on 64 bits targets, if I understand
              correctly.<br>
              ><br>
              > 2 questions:<br>
              >  - Why not generating a selectcc node directly ? It
              avoid having to mess up with intermediate values.<br>
            </div>
            Well first, that’s what it did originally and wasn’t what I
            was changing. selectcc might not be legal, and I’m not sure
            why it even exists.  I don’t see how it’s any harder to
            match select + setcc vs. selectcc, and selectcc just gives
            you another case to worry about.<br>
            <div class=""><br>
              <br>
              >  - Why calling getSetCCResultType(VT) ? VT is not the
              type of a parameter of setcc, and this looks incorrect to
              me.<br>
            </div>
            That’s what it did originally, and what I fixed. It now
            checks getSetCCResultType of the operand’s operand’s value
            type, the setcc’s operand</blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>