<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="Hack Nerd Font Mono">Hi James,</font></p>
    <p><font face="Hack Nerd Font Mono"><br>
      </font></p>
    <p><font face="Hack Nerd Font Mono">Like other constant expressions,
        e.g., i32 0, this GEP constant</font></p>
    <p><font face="Hack Nerd Font Mono">expression are "shown" inlined.
        Constants are unique and exist</font></p>
    <p><font face="Hack Nerd Font Mono">everywhere. I guess the most
        "important' use case I can think</font></p>
    <p><font face="Hack Nerd Font Mono">of is to use such GEPs as part
        of other constant expressions,</font></p>
    <p><font face="Hack Nerd Font Mono">e.g., initializers of constant
        globals.<br>
      </font></p>
    <p><br>
    </p>
    <p>Cheers,</p>
    <p>  Johannes<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 5/31/20 3:49 AM, James
      Courtier-Dutton via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAMvbhFWYBN=KFi3kqr740SxoNPp9TrF7hX19nv5GjkkdL-Hxw@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">Hi,

Why is the getelementptr part of the call instruction, instead of
being a separate instruction in the LLVM IR ?
The LLVM IR Builder adds it as a separate instruction, but it is
rolled into one call instruction in the .bc output.
I am just curious as to why it is done this way.

#include <stdint.h>
#include <stdio.h>
int test21(void);
int test21(void) {
        printf("Hello1\n");
        return 0;
}

define dso_local i32 @test21() #0 {
  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i64 0, i64 0))
  ret i32 0
}
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
  </body>
</html>