This is an archive of the discontinued LLVM Phabricator instance.

[X86] Make sure we don't create locked inc/dec instructions when the carry flag is being used.
ClosedPublic

Authored by craig.topper on Oct 29 2017, 8:17 PM.

Details

Summary

INC/DEC don't update the carry flag so we need to make sure we don't try to use it.

This patch introduces new X86ISD opcodes for locked INC/DEC. Teaches lowerAtomicArithWithLOCK to emit these nodes if INC/DEC is not slow or the function is being optimized for size. An additional flag is added that allows the INC/DEC to be disabled if the caller determines that the carry flag is being requested.

The test_sub_1_cmp_1_setcc_ugt test is currently showing this bug. The other test case changes are recovering cases that were regressed in r316860.

This should fully fix PR35068 finishing the fix started in r316860.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Oct 29 2017, 8:17 PM
craig.topper edited the summary of this revision. (Show Details)
zvi accepted this revision.Oct 30 2017, 4:05 AM

LGTM

This revision is now accepted and ready to land.Oct 30 2017, 4:05 AM
This revision was automatically updated to reflect the committed changes.