[llvm-commits] [llvm-gcc-4.2] r76208 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp
eli.friedman at gmail.com
Fri Jul 17 15:41:34 CDT 2009
On Fri, Jul 17, 2009 at 1:19 PM, Anton
Korobeynikov<anton at korobeynikov.info> wrote:
>> LLVM definitely does not replace a load of an uninitialized variable
>> with unreachable; many optimizations depend on that not happening.
> I already posted the testcase, try it.
Ah, it's deciding it's unreachable because of the *bar. So it's not
really a question of whether loading from an uninitialized alloca is
defined, but whether the contents of the local are defined.
>> So the code in question depends on a local variable tied to a specific
>> register being initialized with whatever happens to be in the register
>> at the start of the function? I think that crosses the line into
>> undefined behavior.
> It depends on the nature of the register. If the register is some
> memory-mapped IO, or, for example, stack / frame pointer - then it's
> not an undefined behaviour.
> As I can see, such constructions are really common in embedded world.
Okay, I guess... as long as it doesn't break tying a variable to an
allocatable register. (I'm specifically worried about a variable
being overwritten because it gets allocated over.)
More information about the llvm-commits