<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-08 12:11 GMT-07:00 Matt Arsenault <span dir="ltr"><<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class="">
<div>On 07/07/2014 09:47 PM, deadal nix
wrote:<br>
</div>
<blockquote type="cite">
<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></div>
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></div></blockquote><div><br></div><div>So this is not possible ?<br></div><div>(select (i64 setcc ...), (i32 -1), (i32 0))<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
The setcc type is i64 for the i64 icmp, so it then needs to be
truncated to 32-bits in this situation<div class=""><br></div></div></blockquote><div><br></div><div>I understand this? Why does the setcc needs to be truncated ? It doesn't look like it usually is.<br><br></div>
<div>I have a test case which is exactly the other way around :<br></div></div>define i32 @test_sext_icmp_i32(i32 %arg) {<br>
%x = icmp eq i32 %arg, 0<br>
%y = sext i1 %x to i64<br>
ret i64 %y<br>
}<br><br></div><div class="gmail_extra">The DAG.getSExtOrTrunc(SetCC,
DL, SelectVT) is returning the node DAGCombiner is working on, which create a loop after the substitution. If I have X = (i64 (sext (i32 (setcc A B)))) to be "combined" as (select X, -1, 0) and then, after substitution occurs, the select become its own condition, creating a loop in the DAG.<br>
</div><div class="gmail_extra"><br></div></div>