[PATCH] D115113: [InstCombine] Do not combine atomic and non-atomic loads.

Ricky Zhou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 5 06:05:47 PST 2021


rickyz created this revision.
rickyz added a reviewer: efriedma.
Herald added a subscriber: hiraditya.
rickyz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.

Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.

Thanks to Eli Friedman for pointing out the bug at
https://bugs.llvm.org/show_bug.cgi?id=51435#c3!

Fixes PR51435.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115113

Files:
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/test/Transforms/InstCombine/pr51435.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115113.391907.patch
Type: text/x-patch
Size: 3989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211205/d3cb5d68/attachment.bin>


More information about the llvm-commits mailing list