[LLVMdev] Bad legalization?

Evan Cheng evan.cheng at apple.com
Mon Sep 15 23:47:31 PDT 2008


On Sep 15, 2008, at 3:05 PM, Villmow, Micah wrote:

> I am getting an assert on a bad legalization.
> Assertion failed: Result.getValueType() == Op.getValueType() && "Bad  
> legalization!", file ..\..\lib\CodeGen\SelectionDAG\LegalizeDAG.cpp,  
> line 3976
>

When you run into issues like this, it helps if you provide a bit more  
information. Please dump out Result, Op, DAG, and / or the DAG before  
legalization starts.


> Can someone explain to me what this means in term of backend code  
> generation, how it might be occurring, and possible ways to fix  
> this? I don’t see how the value type of an operation and the result  
> being the same can cause an issue.

Quite the opposite. It's asserting because the value types of op  
(before legalization) and Result (after) are different.

Evan

> The IR code in question is as follows:
>
> define void @ test_unary_func_absolute_value(i32 %x, i32  
> addrspace(11)* %result) {
> entry:
>         %call = tail call i32 (...)* @abs( i32 %x )             ;  
> <i32> [#uses=1]
>         store i32 %call, i32 addrspace(11)* %result
>         ret void
> }
>
> declare i32 @abs(...)
>
> Micah Villmow
> Systems Engineer
> Advanced Technology & Performance
> Advanced Micro Devices Inc.
> 4555 Great America Pkwy,
> Santa Clara, CA. 95054
> P: 408-572-6219
> F: 408-572-6596
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080915/2da44ee9/attachment.html>


More information about the llvm-dev mailing list