<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63302>63302</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            OpenCL: why the LLVM IR i get is difference with the IR command line generate?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          xusw-cs
      </td>
    </tr>
</table>

<pre>
    i haved called some API to compile  the OpenCL kernel,it succeeds and i get the readable LLVM IR like this:

define spir_kernel void @add_kernel(i32 addrspace(1)* nocapture readonly %a, i32 addrspace(1)* nocapture readonly %b, i32 addrspace(1)* nocapture %c) local_unnamed_addr #0 !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 {
entry:
  %call = tail call spir_func i32 @_Z13get_global_idj(i32 0) #2
  %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %a, i32 %call
  %0 = load i32, i32 addrspace(1)* %arrayidx, align 4, !tbaa !7
  %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %b, i32 %call
  %1 = load i32, i32 addrspace(1)* %arrayidx1, align 4, !tbaa !7
  %add = add nsw i32 %1, %0
  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %c, i32 %call
  store i32 %add, i32 addrspace(1)* %arrayidx2, align 4, !tbaa !7
  ret void
}

but when i derectly use the command line to compile the same OpenCL kernel, the command is:
clang -c -target spir-Unknown-Unknown -x cl -emit-llvm -S -cl-std=CL2.0 -Xclang -finclude-default-header add.cl
and i get the read LLVM IR like this, it is somewhat different with the IR I got using the API call way:

define dso_local spir_kernel void @add_kernel(i32 addrspace(1)* nocapture readonly, i32 addrspace(1)* nocapture readonly, i32 addrspace(1)* nocapture) local_unnamed_addr #0 !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 {
  %4 = tail call spir_func i32 @_Z13get_global_idj(i32 0) #2
  %5 = getelementptr inbounds i32, i32 addrspace(1)* %0, i32 %4
  %6 = load i32, i32 addrspace(1)* %5, align 4, !tbaa !7
  %7 = getelementptr inbounds i32, i32 addrspace(1)* %1, i32 %4
  %8 = load i32, i32 addrspace(1)* %7, align 4, !tbaa !7
  %9 = add nsw i32 %8, %6
  %10 = getelementptr inbounds i32, i32 addrspace(1)* %2, i32 %4
  store i32 %9, i32 addrspace(1)* %10, align 4, !tbaa !7
  ret void
}

my question is:
1、how can i set the dso_local attribute when i  call the API to compile the OpenCL kernel?
2、do i miss some flags or options which result in that the command line use the ssa number %4, %5...., but the IR i got use the  name like %arrayidx? 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUlsFu4zYTx5-GvgxkSJRlyQcfsskaCJAPX7FFi6IXgyLHEjcU6SWpKH77gpScdbJO69R76cU0OJzhf4bib8ick41GXJPiEynuZqz3rbHr594NCXez2ojDWkLLnlAAZ0qhAGc6hJtf7sEb4KbbS4UAvkX4_x717QM8otWoyOcN-XRLqlvpwfWcIwoHTAuQ0KCP6y0ywWqF8PDw-__g_gso-YjgW-lIfkPSO5JOvwJ3UiO4vbTbMTo8GSmALFImxDRFaCVzCkwI6_aMI6FVRuiK0BvQhrO97-24pdHqAIQWjNBb-JhLfZkLoQUndAXKcKa2vdasQ7ENPkBongKh2ah5y2wT57cxWDDkb62co3Pbbz1TwbJ4Y_aHfXQr3szXzOG7xjD_EnEJpPw01hm1t4eX2kPMgykFJL8Dz6SKX8B4DLte81gJski3f2Z5g37bKFMztZXi63QWaSgCoTk9CcisZQcpnmPQBj0q7FD7vbcgdW16LVyI-3eFPj27SeLJBmmMrAwTl8SZ1IRlTMlGwyL8JTTzNWNhLM9oz64TX78vPvs34rML1QsRo4dRu-GoIBtdivRMovS6RPk7iTpvLB4NTIgL86QX5GnRRzZM-CjvT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