diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-11-19 01:02:22 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-11-19 01:02:22 +0000 |
commit | 22df0eb2e81015afa9d74e04ab83e6dc9f21f551 (patch) | |
tree | 6c9fec6ffcafbde5e83ef3946fd12d885c56d54e | |
parent | 81b73f3020af1f68457362bc5177a90d629e5a74 (diff) | |
download | bcm5719-llvm-22df0eb2e81015afa9d74e04ab83e6dc9f21f551.tar.gz bcm5719-llvm-22df0eb2e81015afa9d74e04ab83e6dc9f21f551.zip |
Use a memcpy so that type based alias analysis sees the change.
The other option would be to do something like
if (that.isSingleWord())
VAL = that.VAL;
else
pVal = that.pVal
This bug was causing 86TTI::getIntImmCost to be miscompiled in a LTO
bootstrap in stage2, causing the build of stage3 to fail.
LLVM is getting quiet good at exploiting this. Not sure if there is anything
a sanitizer could do to help
llvm-svn: 222294
-rw-r--r-- | llvm/include/llvm/ADT/APInt.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 4d19bab13f4..f4e7e3c6356 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -665,7 +665,9 @@ public: delete[] pVal; } - VAL = that.VAL; + // Use memcpy so that type based alias analysis sees both VAL and pVal + // as modified. + memcpy(&VAL, &that.VAL, sizeof(uint64_t)); // If 'this == &that', avoid zeroing our own bitwidth by storing to 'that' // first. |