[compiler-rt] 27ddcd5 - [profile] Fix InstrProfGetRangeRepValue to use UINT64_C

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 12:46:18 PST 2021


Author: Fangrui Song
Date: 2021-03-09T12:46:13-08:00
New Revision: 27ddcd51d3ca6158447af4ff954004efb2a2759c

URL: https://github.com/llvm/llvm-project/commit/27ddcd51d3ca6158447af4ff954004efb2a2759c
DIFF: https://github.com/llvm/llvm-project/commit/27ddcd51d3ca6158447af4ff954004efb2a2759c.diff

LOG: [profile] Fix InstrProfGetRangeRepValue to use UINT64_C

This is a minor issue because the TargetValue parameter of `__llvm_profile_instrument_memop`
is usually small and cannot exceed 2**31 at all.

Differential Revision: https://reviews.llvm.org/D97640

Added: 
    

Modified: 
    compiler-rt/include/profile/InstrProfData.inc

Removed: 
    


################################################################################
diff  --git a/compiler-rt/include/profile/InstrProfData.inc b/compiler-rt/include/profile/InstrProfData.inc
index 9112c9fa12b2..c676dc255619 100644
--- a/compiler-rt/include/profile/InstrProfData.inc
+++ b/compiler-rt/include/profile/InstrProfData.inc
@@ -872,7 +872,7 @@ InstrProfGetRangeRepValue(uint64_t Value) {
     return Value;
   else
     // Otherwise, take to the previous power of two + 1.
-    return (1 << (64 - InstProfClzll(Value) - 1)) + 1;
+    return (UINT64_C(1) << (64 - InstProfClzll(Value) - 1)) + 1;
 }
 
 /* Return true if the range that an (observed) memop size value belongs to has


        


More information about the llvm-commits mailing list