aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mca
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-08-15 12:53:38 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-08-15 12:53:38 +0000
commit47bbfe3bd01e23ff8fd416cd3fd9223414c5d9f4 (patch)
tree71a5a66169e40e16470af069e06fb237db2856ef /tools/llvm-mca
parent8ae415fb86e374a3f6a4ac618d9fae13e0f18e25 (diff)
[llvm-mca] Fix PR38575: Avoid an invalid implicit truncation of a processor resource mask (an uint64_t value) to unsigned.
This patch fixes a regression introduced at revision 338702. A processor resource mask was incorrectly implicitly truncated to an unsigned quantity. Later on, the truncated mask was used to initialize an element of a vector of processor resource descriptors. On targets with more than 32 processor resources, some elements of the vector are left uninitialized. As a consequence, this bug might have eventually caused a crash due to null dereference in the Scheduler. This patch fixes PR38575, and adds a test for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mca')
-rw-r--r--tools/llvm-mca/Scheduler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/llvm-mca/Scheduler.cpp b/tools/llvm-mca/Scheduler.cpp
index 764cd23c40d..f6b70d7cdf8 100644
--- a/tools/llvm-mca/Scheduler.cpp
+++ b/tools/llvm-mca/Scheduler.cpp
@@ -59,7 +59,7 @@ void ResourceManager::initialize(const llvm::MCSchedModel &SM) {
Resources.resize(SM.getNumProcResourceKinds());
for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) {
- unsigned Mask = ProcResID2Mask[I];
+ uint64_t Mask = ProcResID2Mask[I];
Resources[getResourceStateIndex(Mask)] =
llvm::make_unique<ResourceState>(*SM.getProcResource(I), I, Mask);
}