This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] CondOpt pass is missing FCMPSri and FCMPDri
ClosedPublic

Authored by zzheng on Oct 30 2014, 4:24 PM.

Details

Summary

We need to bail out on FCMPSri and FCMPDri when searching backward for a CMP which defines the flags used by B.CC.

This patch fixes the following false positive case:

cmp w19, #0
cinc w0, w19, gt
...
fcmp d8, #0.0
b.gt .LBB0_5

Diff Detail

Event Timeline

zzheng updated this revision to Diff 15592.Oct 30 2014, 4:24 PM
zzheng retitled this revision from to [AArch64] CondOpt pass is missing FCMPSri and FCMPDri.
zzheng updated this object.
zzheng edited the test plan for this revision. (Show Details)
zzheng added a subscriber: Unknown Object (MLST).
sdmitrouk edited edge metadata.Oct 31 2014, 4:23 AM

Hi,

again my bad, sorry about that. Please see one inline comment.

Thanks for fixing this!

Regards,
Sergey

lib/Target/AArch64/AArch64ConditionOptimizer.cpp
165

I checked FPComparison multiclass from AArch64InstrFormats.td and it creates 4 forms of an instruction. I missed ri forms for both FCMP and FCMPE, which means that two more cases should be added here as well:

case AArch64::FCMPEDri:
case AArch64::FCMPESri:
mcrosier edited edge metadata.Oct 31 2014, 6:34 AM
mcrosier added a subscriber: mcrosier.
mcrosier accepted this revision.Oct 31 2014, 7:36 AM
mcrosier added a reviewer: mcrosier.

Hi Zhaoshi,
Assuming you address my comments as well as handle all four cases (FCMPDri, FCMPSri, FCMPEDri, FCMPESri) this LGTM.

Chad

test/CodeGen/AArch64/combine-comparisons-by-cse.ll
361

Please add : after the function name.

Explicitly,

; CHECK-LABEL: fcmpri:

385

Please remove 'tail' from the call site.

Multiple instances in the test case.

This revision is now accepted and ready to land.Oct 31 2014, 7:36 AM
mcrosier closed this revision.Oct 31 2014, 8:28 AM

Committed r220961.