search for: takeaddr

Displaying 3 results from an estimated 3 matches for "takeaddr".

2013 Feb 01
2
[LLVMdev] Question about compilation result - taking address of input array member
Hello, I'm playing around with some LEA-related code generation on x86-64 (trunk LLVM & Clang), and I run into a case I don't understand: $ cat takeaddr.c int* bar(int table[10]) { return &table[2]; } $ clang -cc1 -emit-llvm takeaddr.c $ cat takeaddr.ll ; ModuleID = 'takeaddr.c' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8...
2013 Feb 01
0
[LLVMdev] Question about compilation result - taking address of input array member
On Fri, Feb 1, 2013 at 12:11 PM, Eli Bendersky <eliben at google.com> wrote: > Hello, > > I'm playing around with some LEA-related code generation on x86-64 > (trunk LLVM & Clang), and I run into a case I don't understand: > > $ cat takeaddr.c > int* bar(int table[10]) { > return &table[2]; > } > > $ clang -cc1 -emit-llvm takeaddr.c > $ cat takeaddr.ll > ; ModuleID = 'takeaddr.c' > target datalayout = > "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-...
2013 Feb 14
1
[LLVMdev] Question about compilation result - taking address of input array member
..., but the alloca, store and load can be removed by the mem2reg pass, which isn't run by codegen prepare in llc. If you invoke clang with -O1 or above it will run mem2reg, producing IR that contains only the gep, and that produces the assembly you're looking for: $ clang -cc1 -emit-llvm -O1 takeaddr.c $ cat takeaddr.ll define i32* @bar(i32* %table) nounwind readnone { entry: %arrayidx = getelementptr inbounds i32* %table, i64 2 ret i32* %arrayidx } $ llc takeaddr.ll $ cat takeaddr.s <snip> _bar: ## @bar ## BB#0: ## %e...