[PATCH] D58744: [CodeGen] Fix some broken IR generated by -fsanitize=unsigned-integer-overflow

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 15:09:13 PST 2019


erik.pilkington created this revision.
erik.pilkington added reviewers: rjmccall, arphaman, ahatanak.
Herald added subscribers: jdoerfert, jfb, dexonsmith, jkorous.
Herald added a project: clang.

I think the author of the function assumed that `GetInsertBlock()` wouldn't change from where `atomicPHI` was created, but this isn't true when `-fsanitize=unsigned-integer-overflow` is enabled (we generate an overflow/continuation label). Fix by keeping track of the block we want to return to to complete the cmpxchg loop.

rdar://48406558

Thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D58744

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGen/sanitize-atomic-int-overflow.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58744.188631.patch
Type: text/x-patch
Size: 4114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190227/022e0be9/attachment.bin>


More information about the cfe-commits mailing list