[LLVMdev] alloca not in first bb behaving differently

Sanjoy Das
Sun, 05 Apr 2015 22:10:47 -0000

spot
> an error? I don't see any.

Does it segfault the optimizer or when run?  If I run your fragment
through opt -O3 (on LLVM trunk) after correcting for syntax (due to
the unified pointer type changes), I get

define i32 @M() #0 {
entry:
  ret i32 3
}

attributes #0 = { nounwind readnone }

which looks like what you'd want.

Just running it through llc (no -O3) gives me

.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 14, 1
.globl _M
.align 4, 0x90
_M:                                     ## @M
.cfi_startproc
## BB#0:                                ## %if.then
movl $333, -4(%rsp)          ## imm = 0x14D
movl $3, -8(%rsp)
movl $3, %eax
retq
.cfi_endproc


.subsections_via_symbols


which also looks correct.

-- Sanjoy