This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Keep flags on the condition when instantiating a CB branch.
ClosedPublic

Authored by ab on Nov 6 2014, 6:00 PM.

Details

Summary

Reversing a CB* instruction used to drop the flags on the condition. On the included testcase, this lead to a read from an undefined vreg.
Using addOperand keeps the flags.

Also, I'm not sure it's a good thing that the idiom:

BuildMI(...).addReg(MO->getReg())

is preferred to:

BuildMI(...).addOperand(MO)

Here this actually makes a difference, I'm wondering if there are other places where the difference is more important than some missing undef.

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 15903.Nov 6 2014, 6:00 PM
ab retitled this revision from to [AArch64] Keep flags on the condition when instantiating a CB branch..
ab updated this object.
ab edited the test plan for this revision. (Show Details)
ab added a reviewer: t.p.northover.
ab added a subscriber: Unknown Object (MLST).
t.p.northover accepted this revision.Nov 6 2014, 6:36 PM
t.p.northover edited edge metadata.

Interesting point on the general principle; I'll have to bear it in mind in future. A common case is expanding a single instruction to multiple ones, where you often need to use different flags on the same register throughout the process.

Either way, this patch looks obvious. Go for it!

Tim.

This revision is now accepted and ready to land.Nov 6 2014, 6:36 PM
ab closed this revision.Nov 6 2014, 7:01 PM
ab updated this revision to Diff 15908.

Closed by commit rL221507 (authored by @ab).