summaryrefslogtreecommitdiffstats
path: root/llvm/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
commita03f2a77f8ef84aa8339a3da51400792f61804d3 (patch)
treeb1c899b797f84b2ff689b72cd34f972698cf8eeb /llvm/tools/llvm-mca
parentf3b5943ffca79a3c8ef5c7734e6c7df6b8a75a53 (diff)
downloadbcm5719-llvm-a03f2a77f8ef84aa8339a3da51400792f61804d3.tar.gz
bcm5719-llvm-a03f2a77f8ef84aa8339a3da51400792f61804d3.zip
[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. llvm-svn: 339768
Diffstat (limited to 'llvm/tools/llvm-mca')
-rw-r--r--llvm/tools/llvm-mca/Scheduler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/Scheduler.cpp
index 764cd23c40d..f6b70d7cdf8 100644
--- a/llvm/tools/llvm-mca/Scheduler.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud