<div dir="ltr"><pre id="c5" class="" style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);padding-top:0.5em;outline:none;font-size:medium;line-height:16.25px"><span style="font-family:arial,sans-serif;font-size:small;line-height:normal;color:rgb(34,34,34)">On Tue, Jun 30, 2015 at 6:24 PM, Hal Finkel </span><span dir="ltr" style="font-family:arial,sans-serif;font-size:small;line-height:normal;color:rgb(34,34,34)"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span><span style="font-family:arial,sans-serif;font-size:small;line-height:normal;color:rgb(34,34,34)"> wrote:</span><br></pre><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">----- Original Message -----<br>
> From: "Bjarke Roune" <<a href="mailto:broune@google.com">broune@google.com</a>><br>
</span><span class="">> To: "Jingyue Wu" <<a href="mailto:jingyue@google.com">jingyue@google.com</a>><br>
> Cc: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
> Sent: Tuesday, June 30, 2015 8:16:13 PM<br>
> Subject: Re: [LLVMdev] Deriving undefined behavior from nsw/inbounds/poison for scalar evolution<br>
><br>
> Hi Adam,<br>
><br>
> Jingyue is right. We need to keep things in 32 bits because 64 bit<br>
> arithmetic is more expensive and because one 64 bit register<br>
> consumes two 32 bit registers.<br>
><br>
<br>
</span>What benefit to you get from listing i64 as a legal integer width in the DataLayout for NVPTX?<br>
<br>
 -Hal<br>
<span class=""><br></span></blockquote><div><br></div><div>LSR only considers legal widths, so I think that then we could not generate a 64 bit induction variable to get a pointer induction variable if we make 64 bit illegal. From IVUsers.cpp:</div><div><br></div><div><pre id="c5" class="" style="font-size:medium;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);padding-top:0.5em;outline:none;line-height:16.25px"><span class="" id="c5_133">  <span class="" style="color:rgb(136,0,0)">// LSR is not APInt clean, do not touch integers bigger than 64-bits.</span>
</span><span class="" id="c5_134">  <span class="" style="color:rgb(136,0,0)">// Also avoid creating IVs of non-native types. For example, we don't want a</span>
</span><span class="" id="c5_135">  <span class="" style="color:rgb(136,0,0)">// 64-bit IV in 32-bit code just because the loop has one 64-bit cast.</span>
</span><span class="" id="c5_136">  <a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_grte_v4-5Fx86_release_usr_grte_v4_include_stdint.h-26l-3D55-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3Duint64-5Ft&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=S5qoBbMORVzv2QGHbY35VdprQrWysW2rLSJf2BGbiZo&e=" style="color:rgb(85,26,139);text-decoration:none">uint64_t</a> <a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-26l-3D136-26ct-3Dxref-5Fusages-26gs-3Dcpp-3Allvm-3A-3Aclass-2DIVUsers-3A-3AAddUsersImpl-28llvm-3A-3AInstruction-252520-2A-2C-252520llvm-3A-3ASmallPtrSetImpl-25253Cllvm-3A-3ALoop-252520-2A-25253E-252520-26amp-3B-29-3A-3AWidth-40google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-3A5494-25257Cdef-26gsn-3DWidth&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=m8us10nhL7vqmKWgbd3V7VA0OkKtdn_-HUp5z1gQZ80&e=" style="color:rgb(85,26,139);text-decoration:none">Width</a> = <a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_include_llvm_Analysis_IVUsers.h-26l-3D124-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DSE&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=VAa9yDij1eotaZYt6fd5Xdx_NOaBxTI6ZaAHQFHPJnk&e=" style="color:rgb(85,26,139);text-decoration:none">SE</a>-><a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_ScalarEvolution.cpp-26l-3D3256-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DgetTypeSizeInBits&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=-WGap-Vm5ioeDH0Cw_CIyrwdmLMPTmVIeH4np8D4j0w&e=" style="color:rgb(85,26,139);text-decoration:none">getTypeSizeInBits</a>(<a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-26l-3D115-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DI&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=xMm2hKMS9F6GR5RYLW_-uGjGQ4faTpKOLdwUrpqqEDw&e=" style="color:rgb(85,26,139);text-decoration:none">I</a>-><a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_include_llvm_IR_Value.h-26l-3D222-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DgetType&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=BxEcPdOZpCD9l3sJTqFmLHoBX-2CYHCXA2emBTaOuH0&e=" style="color:rgb(85,26,139);text-decoration:none">getType</a>());
</span><span class="" id="c5_137">  <span class="" style="color:rgb(0,0,136)">if</span> (<a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-26l-3D136-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DWidth&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=XP7yrJdViK1plBEtwyo6zXBYB5CyheR_FHLJL2HX_Dk&e=" style="color:rgb(85,26,139);text-decoration:none">Width</a> > <span class="" style="color:rgb(0,102,102)">64</span> || !<a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-26l-3D117-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DDL&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=k3bearKP0VvU3ekpvZRHOlZcZO9Dn2vGAnh6cQ61960&e=" style="color:rgb(85,26,139);text-decoration:none">DL</a>.<a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_include_llvm_IR_DataLayout.h-26l-3D239-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DisLegalInteger&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=CLT9SmBQfDQnwsw4g3JKwlXYW2WfPvl7FRrZPj4Qsqw&e=" style="color:rgb(85,26,139);text-decoration:none;background-color:rgb(255,255,170)">isLegalInteger</a>(<a class="" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cs.corp.google.com_-23piper___depot_google3_third-5Fparty_llvm_llvm_lib_Analysis_IVUsers.cpp-26l-3D136-26ct-3Dxref-5Fjump-5Fto-5Fdef-26cl-3DGROK-26gsn-3DWidth&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=HIDsdD-AJi1FuoYyDgfeFSaA_FDGN8d63xuY0-ml9nU&s=XP7yrJdViK1plBEtwyo6zXBYB5CyheR_FHLJL2HX_Dk&e=" style="color:rgb(85,26,139);text-decoration:none">Width</a>))
</span><span class="" id="c5_138">    <span class="" style="color:rgb(0,0,136)">return</span> <span class="" style="color:rgb(0,0,136)">false</span>;</span></pre></div><div><span class=""><br></span></div><div><span class="">When I wrote "we need to keep things in 32 bits", I meant that some 32 bit induction variables should stay in 32 bits, but we do want 64 bit induction variables in some common cases. The usual such case is for pointer induction variables, since pointers are 64 bit. Another case is if we get programs where the indices are already 64 bit in the input program - we still want to do strength reduction in that case. This happens naturally when using a size_t as the index.<br></span></div><div><span class=""><br></span></div><div><span class="">It may be that we would benefit from changing some of the callers of isLegalInteger, like the one above, to handle illegal bit widths better and then at that point we'd want to make 64 bit illegal.</span></div><div><br></div><div>Bjarke</div></div></div></div>