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 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. 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080915/d841b24f/attachment.html>
On Mon, Sep 15, 2008 at 3:05 PM, Villmow, Micah <Micah.Villmow at amd.com> 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 > > > > 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.This roughly means that the type of the result of running SelectionDAGLegalize::LegalizeOp is not the same as the type of the argument to LegalizeOp. Most likely, your custom legalization messing up, although it's possible there's a bug in SelectionDAGLegalize::LegalizeOp. -Eli
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>
It is conceivable that it's sensitive to the name "abs", try changing it. On Sep 15, 2008, at 11:47 PMPDT, Evan Cheng wrote:> > 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 > > _______________________________________________ > 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/20080916/66b9b13c/attachment.html>
Apparently Analagous Threads
- [LLVMdev] Bad legalization?
- [LLVMdev] [PATCH] Add new phase to legalization to handle vector operations
- [LLVMdev] [PATCH] Add new phase to legalization to handle vector operations
- [LLVMdev] [PATH] Add sub.ovf/mul.ovf intrinsics
- [LLVMdev] Store patterns accepting i32 only?