Hatanaka, Akira
2012-Jun-01 00:27 UTC
[LLVMdev] legalization of truncating stores in LegalizeDAG.cpp
In LegalizeDAG.cpp, truncating stores are custom-lowered in line 1314-1317: 1314 case TargetLowering::Custom: 1315 ReplaceNode(SDValue(Node, 0), 1316 TLI.LowerOperation(SDValue(Node, 0), DAG)); 1317 break; Is there a reason it doesn't check whether the SDValue returned from TargetLowering::LowerOperation is null before it replaces the original node with the returned node? The return value is checked everywhere else TLI.LowerOperation is called (line 937, for example). 937 Tmp1 = TLI.LowerOperation(Tmp3, DAG); 938 if (Tmp1.getNode()) { 939 Tmp3 = Tmp1; 940 Tmp4 = Tmp1.getValue(1); 941 } 942 break; -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120601/f10d508d/attachment.html>
Duncan Sands
2012-Jun-01 07:59 UTC
[LLVMdev] legalization of truncating stores in LegalizeDAG.cpp
Hi Akira, On 01/06/12 02:27, Hatanaka, Akira wrote:> In LegalizeDAG.cpp, truncating stores are custom-lowered in line 1314-1317: > > 1314 case TargetLowering::Custom: > 1315 ReplaceNode(SDValue(Node, 0), > 1316 TLI.LowerOperation(SDValue(Node, 0), DAG)); > 1317 break; > > Is there a reason it doesn't check whether the SDValue returned from > TargetLowering::LowerOperation is null before it replaces the original node with > the returned node? The return value is checked everywhere else > TLI.LowerOperation is called (line 937, for example). > > > 937 Tmp1 = TLI.LowerOperation(Tmp3, DAG); > 938 if (Tmp1.getNode()) { > 939 Tmp3 = Tmp1; > 940 Tmp4 = Tmp1.getValue(1); > 941 } > 942 break;probably it's just an oversight, because no backend needed it. LegalizeDAG is unfortunately full of code like this. Ciao, Duncan.
Akira Hatanaka
2012-Jun-01 19:17 UTC
[LLVMdev] legalization of truncating stores in LegalizeDAG.cpp
Hi Duncan, It seems that none of the current targets custom-lower truncating stores. When I added code to do custom-lowering in the Mips backend, the original node gets removed if LowerOperation returns SDValue(). This resulted in an assertion raised when DAGCombiner::visitTokenFactor was executed. I will add code in LegalizeDAG.cpp to check the returned value later. On Fri, Jun 1, 2012 at 12:59 AM, Duncan Sands <baldrick at free.fr> wrote:> Hi Akira, > > On 01/06/12 02:27, Hatanaka, Akira wrote: > > In LegalizeDAG.cpp, truncating stores are custom-lowered in line > 1314-1317: > > > > 1314 case TargetLowering::Custom: > > 1315 ReplaceNode(SDValue(Node, 0), > > 1316 TLI.LowerOperation(SDValue(Node, 0), DAG)); > > 1317 break; > > > > Is there a reason it doesn't check whether the SDValue returned from > > TargetLowering::LowerOperation is null before it replaces the original > node with > > the returned node? The return value is checked everywhere else > > TLI.LowerOperation is called (line 937, for example). > > > > > > 937 Tmp1 = TLI.LowerOperation(Tmp3, DAG); > > 938 if (Tmp1.getNode()) { > > 939 Tmp3 = Tmp1; > > 940 Tmp4 = Tmp1.getValue(1); > > 941 } > > 942 break; > > probably it's just an oversight, because no backend needed it. > LegalizeDAG is > unfortunately full of code like this. > > Ciao, Duncan. > _______________________________________________ > 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/20120601/0e86ba62/attachment.html>
Apparently Analagous Threads
- [LLVMdev] legalization of truncating stores in LegalizeDAG.cpp
- returning from LowerOperation()
- [LLVMdev] PIC16 backend for llvm 2.5
- [LLVMdev] PIC16 backend for llvm 2.5
- [LLVMdev] [NVPTX] Backend failure in LegalizeDAG due to unimplemented expand in target lowering