Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.lightlink.com!news.iecc.com!lnews.iecc.com!nerds-end From: "Amker.Cheng" Newsgroups: comp.compilers Subject: How to eliminate redundant constant move instructions Date: Mon, 31 Oct 2011 17:53:46 +0800 Organization: Compilers Central Lines: 24 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-10-019@comp.compilers> NNTP-Posting-Host: lnews.iecc.com X-Trace: gal.iecc.com 1320072598 352 64.57.183.34 (31 Oct 2011 14:49:58 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 31 Oct 2011 14:49:58 +0000 (UTC) Keywords: optimize, question Posted-Date: 31 Oct 2011 10:49:58 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:301 Hi, I found following intermediate codes are generated in gcc rx <- 0 ... use rx ... ry <- 0 use ry ... It's normally a result of const propagation. After register allocation, It is likely rx/ry get allocated into different hard registers. Thus in final codes, there would be a redundant "move 0" instruction. The story even stands for Os compiling, so the question is: Is there any optimization technique dedicates to this kind of case? Or is it normally handled by other optimizations as sub task? Thanks very much. -- Best Regards.