Right. DAGCombine will insert *illegal* nodes before legalize. Evan On Jan 19, 2009, at 8:17 PM, Eli Friedman wrote:> On Mon, Jan 19, 2009 at 6:36 PM, Scott Michel <scottm at aero.org> wrote: >> I just ran across something interesting: DAGCombine inserts a 64-bit >> constant as the result of converting a (bitconvert (fabs val)) to a >> (and (bitconvert val), i64const). >> >> The problem: i64 constants have to be legalized for the CellSPU >> platform. DAGCombine is doing the right thing but it's not doing the >> right thing for CellSPU and it's damed difficult to work around this >> "feature". Moreover, the way all of SelectionDAGLegalize and >> DAGCombne's code is written, it's particularly difficult to "re- >> legalize" nodes unless one more legalization pass is invoked after >> DAGCombine. > > I don't think DAGCombine should be doing a transform like that > post-legalize; if it is, it's probably a bug. > > -Eli > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Tuesday 20 January 2009 07:52:37 Evan Cheng wrote:> Right. DAGCombine will insert *illegal* nodes before legalize.There are two stages of legalization: legalization of types, followed by legalization of operations. Before type legalization DAGCombine is allowed to create nodes with illegal types and illegal operations. After type legalization but before operation legalization it is allowed to create nodes with illegal operations, but all types must be legal. After operation legalization it is only allowed to create fully legal nodes. Inside DAGCombine this is specified by two flags: LegalTypes being true means that all nodes must have legal types. LegalOperations being true means that all nodes must have legal operations (as well as types: LegalTypes will also be true). So if LegalTypes is true and nonetheless a constant with an illegal type is being created then that is a DAG combiner bug. Ciao, Duncan.
On Tue, Jan 20, 2009 at 12:24 AM, Duncan Sands <baldrick at free.fr> wrote:> So if LegalTypes is true and nonetheless a constant with an > illegal type is being created then that is a DAG combiner bug.The issue here isn't that i64 is illegal, it's that constants of type i64 are illegal. I'm tempted to say that having legal constants should be a requirement for marking an integer type legal... -Eli
Evan: And after legalize too. DAGCombine gets run after legalization. :-) -scooter On Jan 19, 2009, at 10:52 PM, Evan Cheng wrote:> Right. DAGCombine will insert *illegal* nodes before legalize. > > Evan > > On Jan 19, 2009, at 8:17 PM, Eli Friedman wrote: > >> On Mon, Jan 19, 2009 at 6:36 PM, Scott Michel <scottm at aero.org> >> wrote: >>> I just ran across something interesting: DAGCombine inserts a 64-bit >>> constant as the result of converting a (bitconvert (fabs val)) to a >>> (and (bitconvert val), i64const). >>> >>> The problem: i64 constants have to be legalized for the CellSPU >>> platform. DAGCombine is doing the right thing but it's not doing the >>> right thing for CellSPU and it's damed difficult to work around this >>> "feature". Moreover, the way all of SelectionDAGLegalize and >>> DAGCombne's code is written, it's particularly difficult to "re- >>> legalize" nodes unless one more legalization pass is invoked after >>> DAGCombine. >> >> I don't think DAGCombine should be doing a transform like that >> post-legalize; if it is, it's probably a bug. >> >> -Eli >> _______________________________________________ >> 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
Duncan: DAGCombine is inserting an IllegalOperation after target-specific instruction legalization has occurred. I'm inserting the fabs and the bitconvert during instruction legalization; DAGCombine is converting the fabs/bitconvert to an 'and' on its second (third?) pass. -scooter On Jan 20, 2009, at 12:24 AM, Duncan Sands wrote:> On Tuesday 20 January 2009 07:52:37 Evan Cheng wrote: >> Right. DAGCombine will insert *illegal* nodes before legalize. > > There are two stages of legalization: legalization of types, > followed by legalization of operations. Before type legalization > DAGCombine is allowed to create nodes with illegal types and illegal > operations. After type legalization but before operation legalization > it is allowed to create nodes with illegal operations, but all types > must be legal. After operation legalization it is only allowed to > create fully legal nodes. > > Inside DAGCombine this is specified by two flags: > LegalTypes being true means that all nodes must have legal types. > LegalOperations being true means that all nodes must have legal > operations (as well as types: LegalTypes will also be true). > > So if LegalTypes is true and nonetheless a constant with an > illegal type is being created then that is a DAG combiner bug. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Jan 20, 2009, at 8:50 AM, Scott Michel wrote:> Evan: > > And after legalize too. DAGCombine gets run after legalization. :-)Yes? It nows if it's run after legalization. Like Duncan said, if it's inserting illegal nodes after legalization, then it's a bug. Evan> > > > -scooter > > On Jan 19, 2009, at 10:52 PM, Evan Cheng wrote: > >> Right. DAGCombine will insert *illegal* nodes before legalize. >> >> Evan >> >> On Jan 19, 2009, at 8:17 PM, Eli Friedman wrote: >> >>> On Mon, Jan 19, 2009 at 6:36 PM, Scott Michel <scottm at aero.org> >>> wrote: >>>> I just ran across something interesting: DAGCombine inserts a 64- >>>> bit >>>> constant as the result of converting a (bitconvert (fabs val)) to a >>>> (and (bitconvert val), i64const). >>>> >>>> The problem: i64 constants have to be legalized for the CellSPU >>>> platform. DAGCombine is doing the right thing but it's not doing >>>> the >>>> right thing for CellSPU and it's damed difficult to work around >>>> this >>>> "feature". Moreover, the way all of SelectionDAGLegalize and >>>> DAGCombne's code is written, it's particularly difficult to "re- >>>> legalize" nodes unless one more legalization pass is invoked after >>>> DAGCombine. >>> >>> I don't think DAGCombine should be doing a transform like that >>> post-legalize; if it is, it's probably a bug. >>> >>> -Eli >>> _______________________________________________ >>> 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 > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Seemingly Similar Threads
- [LLVMdev] visitBIT_CONVERT (previous Shouldn't DAGCombine insert legal nodes?)
- [LLVMdev] Shouldn't DAGCombine insert legal nodes?
- [LLVMdev] Shouldn't DAGCombine insert legal nodes?
- [LLVMdev] visitBIT_CONVERT (previous Shouldn't DAGCombine insert legal nodes?)
- [LLVMdev] visitBIT_CONVERT (previous Shouldn't DAGCombine insert legal nodes?)