[llvm] r349224 - [SILoadStoreOptimizer] Use std::abs to avoid truncation.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 14 17:32:58 PST 2018
Author: fhahn
Date: Fri Dec 14 17:32:58 2018
New Revision: 349224
URL: http://llvm.org/viewvc/llvm-project?rev=349224&view=rev
Log:
[SILoadStoreOptimizer] Use std::abs to avoid truncation.
Using regular abs() causes the following warning
error: absolute value function 'abs' given an argument of type 'int64_t' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
(uint32_t)abs(Dist) > MaxDist) {
^
lib/Target/AMDGPU/SILoadStoreOptimizer.cpp:1369:19: note: use function 'std::abs' instead
which causes a bot to fail:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/18284/steps/bootstrap%20clang/logs/stdio
Modified:
llvm/trunk/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp?rev=349224&r1=349223&r2=349224&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp Fri Dec 14 17:32:58 2018
@@ -1366,8 +1366,8 @@ bool SILoadStoreOptimizer::promoteConsta
AM.HasBaseReg = true;
AM.BaseOffs = Dist;
if (TLI->isLegalGlobalAddressingMode(AM) &&
- (uint32_t)abs(Dist) > MaxDist) {
- MaxDist = abs(Dist);
+ (uint32_t)std::abs(Dist) > MaxDist) {
+ MaxDist = std::abs(Dist);
AnchorAddr = MAddrNext;
AnchorInst = &MINext;
More information about the llvm-commits
mailing list