[CodeGen] Fix some broken IR generated by -fsanitize=unsigned-integer-overflow
authorErik Pilkington <erik.pilkington@gmail.com>
Thu, 28 Feb 2019 00:47:55 +0000 (00:47 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Thu, 28 Feb 2019 00:47:55 +0000 (00:47 +0000)
commit53e43f4d9e8e4f3fd1bd2ed1a81af1b8870b92a7
tree5e9a794d435aa0a283a0d4e15a063ff87e4e7637
parent22efccf9ab22b5c1af63676616ec1215d96bfb5d
[CodeGen] Fix some broken IR generated by -fsanitize=unsigned-integer-overflow

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

Differential revision: https://reviews.llvm.org/D58744

llvm-svn: 355054
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/sanitize-atomic-int-overflow.c [new file with mode: 0644]