[llvm-commits] [llvm-gcc-4.2] r76208 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp

Anton Korobeynikov anton at korobeynikov.info
Fri Jul 17 13:19:07 PDT 2009


Hi, Eli

> 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.

> 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.

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University




More information about the llvm-commits mailing list