[all-commits] [llvm/llvm-project] 2d1b02: [DSE][NFC] Need to be carefull mixing signed and u...
ebrevnov via All-commits
all-commits at lists.llvm.org
Tue Dec 8 01:54:05 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2d1b024d06b2a81f1c35193a998a864be09e2ae8
https://github.com/llvm/llvm-project/commit/2d1b024d06b2a81f1c35193a998a864be09e2ae8
Author: Evgeniy Brevnov <ybrevnov at azul.com>
Date: 2020-12-08 (Tue, 08 Dec 2020)
Changed paths:
M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Log Message:
-----------
[DSE][NFC] Need to be carefull mixing signed and unsigned types
Currently in some places we use signed type to represent size of an access and put explicit casts from unsigned to signed.
For example: int64_t EarlierSize = int64_t(Loc.Size.getValue());
Even though it doesn't loos bits (immidiatly) it may overflow and we end up with negative size. Potentially that cause later code to work incorrectly. A simple expample is a check that size is not negative.
I think it would be safer and clearer if we use unsigned type for the size and handle it appropriately.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D92648
More information about the All-commits
mailing list