[llvm-commits] [llvm] r164866 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/2012-09-28-CGPBug.ll

Evan Cheng evan.cheng at apple.com
Fri Oct 12 17:55:48 PDT 2012


On Oct 12, 2012, at 5:01 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Mon, Oct 8, 2012 at 1:13 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>> 
>> On Oct 7, 2012, at 11:20 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>> 
>>> 
>>> On 07.10.2012, at 20:06, Evan Cheng <evan.cheng at apple.com> wrote:
>>> 
>>>> In global JT, he addresses of other blocks are used. If they are merged into other blocks, then you end up with invalid values like this:
>>>> _JT:
>>>>      .long   Ltmp2-Ltmp0
>>>>      .long   Ltmp1-Ltmp0
>>>>      .long   1-Ltmp2
>>>>      .long   1-Ltmp1
>>> 
>>> Taking the address of a block that's not used in an indirectbr is undefined behavior (except for comparisons against null). There are many passes that can discard dead blocks and cause this kind of code to be emitted and I think the problem here is that the assembler chokes on "1-label", I see a couple of ways to fix this but none is really satisfying:
>> 
>> Good point. However, this is another case where programmer's expectation might not match the spec. I view this patch as being friendly to programmers without causing harm.
> 
> The problem is, this isn't the only place where we eliminate dead
> blocks... e.g. SimplifyCFG doesn't check whether a block's address is
> taken.

Patches welcome. :-)

Evan

> 
> -Eli




More information about the llvm-commits mailing list