[llvm-dev] alloca

Bruce Hoult via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 5 05:28:26 PDT 2017


Sure. Loads and stores.

int foo(int i){
  return i;
}

$ clang alloca.c -S -emit-llvm
$ cat alloca.ll
; ModuleID = 'alloca.c'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

; Function Attrs: nounwind uwtable
define i32 @foo(i32 %i) #0 {
  %1 = alloca i32, align 4
  store i32 %i, i32* %1, align 4
  %2 = load i32, i32* %1, align 4
  ret i32 %2
}

attributes #0 = { nounwind uwtable "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="true"
"no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2"
"unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.ident = !{!0}

!0 = !{!"clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"}


On Tue, Sep 5, 2017 at 3:17 PM, Anastasiya Ruzhanskaya via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello,
> is the alloca instruction itself valid input for stores instructions ( and
> maybe some others?). In all realistic examples I encountered it as input
> only to getelementptr instruction.
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170905/884ecc70/attachment.html>


More information about the llvm-dev mailing list