Page MenuHomePhabricator

CodeGen: set correct result for atomic compound expressions
ClosedPublic

Authored by t.p.northover on Sep 11 2019, 4:29 AM.

Details

Reviewers
jfb
Summary

Atomic compound expressions try to use atomicrmw if possible, but this path doesn't set the Result variable, leaving it to crash in later code if anything ever tries to use the result of the expression. This fixes that issue by recalculating the new value based on the old one atomically loaded.

Diff Detail

Event Timeline

t.p.northover created this revision.Sep 11 2019, 4:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2019, 4:29 AM
Herald added subscribers: jfb, mcrosier. · View Herald Transcript
jfb accepted this revision.Sep 27 2019, 9:27 AM

Separately, does this do floating-point add / sub properly? We added them too C++20.

This revision is now accepted and ready to land.Sep 27 2019, 9:27 AM
t.p.northover closed this revision.Nov 7 2019, 6:00 AM

Thanks JF.

To github.com:llvm/llvm-project.git

0ec6a4882ee..10e0d64337d  master -> master

Separately, does this do floating-point add / sub properly? We added them too C++20.

It looks like that already works because it doesn't/can't use LLVM's atomicrmw path.