[LLVMdev] Help me improve two-address code
evan.cheng at apple.com
Thu Apr 16 17:07:09 PDT 2009
On Apr 16, 2009, at 4:25 PM, Greg McGary wrote:
> Evan Cheng wrote:
>> On Apr 16, 2009, at 3:17 PM, Greg McGary wrote:
>>> Is there some optimizer knob I'm not turning properly? In more
>>> cases, GCC does poorly with two-address operand choices and so
>>> the code with unnecessary register moves. I have high hopes LLVM
>>> can do better, so this result for a simple case is bothersome.
>> Are you marking add as commutable? Are you making mov as a copy
> How do I mark them? For the commutative property, I observed this
> def add : SDNode<"ISD::ADD" , SDTIntBinOp ,
> [SDNPCommutative, SDNPAssociative]>;
Yes, the "target-independent" ISD::ADD node is commutative. But it
doesn't mean the target specific instruction it is selected to has to
> ... and assumed it was sufficient, since I saw no other targets making
> special arrangements.
In X86InstrInfo.td, ADD32rr (and lots others) are marked isCommutable.
> I see no obvious (to me, anyway 8^) "copy instruction" property. The
> insn in question is generated by copyRegToReg(), and satisfies the
> isMoveInstr() predicate.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev