[LLVMdev] Unnecessary moves after sign-extension in 2-address target
evan.cheng at apple.com
Tue Apr 21 22:03:56 PDT 2009
On Apr 21, 2009, at 4:02 PM, Greg McGary wrote:
> Dan Gohman wrote:
>> On Apr 19, 2009, at 6:15 PM, Greg McGary wrote:
>>> Because sextb_r and sextw_r have destination tied to source
>>> TwoAddressInstructionPass thinks it needs a copy. However, since
>>> sext kills its source, the copy is unnecessary. Why does this
>>> Is TwoAddressInstructionPass relying on a later pass to notice this
>>> transform it again?
>> Yes, the later pass is the coalescer. It would be worthwhile to
>> understand why it is not coalescing the copies.
> I discovered a curious phenomenon:
> The copies are necessary because TwoAddressInstructionPass commutes
> the second add. When I suppress the commute, the movs disappear and
> the code became optimal. It seems the two-address commuter is
> either buggy
> or inherently short-sighted/simple-minded and paints itself into a
> How do you recommend I approach this problem?
You can try to identify the problem in 2addr pass and try to provide
us with a patch. Or file a bugzilla with a reproducible test case.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev