[PGO] Fix build errors in x86_64-darwin
authorRong Xu <xur@google.com>
Tue, 24 Nov 2015 21:55:50 +0000 (21:55 +0000)
committerRong Xu <xur@google.com>
Tue, 24 Nov 2015 21:55:50 +0000 (21:55 +0000)
Fix buildbot failure for x86_64-darwin due to r254021

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254028 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/CFGMST.h
lib/Transforms/Instrumentation/PGOInstrumentation.cpp

index 3f0496d30731ec5ef6a4cc4cd4f9321470583971..71a827617415661d6c62e5fb8b441775bd1b9d0c 100644 (file)
@@ -97,7 +97,7 @@ public:
       uint64_t BBWeight = BFI->getBlockFreq(&*BB).getFrequency();
       uint64_t Weight;
       if (int successors = TI->getNumSuccessors()) {
-        for (uint32_t i = 0; i != successors; ++i) {
+        for (int i = 0; i != successors; ++i) {
           BasicBlock *TargetBB = TI->getSuccessor(i);
           bool Critical = isCriticalEdge(TI, i);
           uint64_t scaleFactor = BBWeight;
index 6d4a8ac9793fe669a614af9bde32c79415911606..89e4cd7a0c48f2c759081024de60a81067e11197 100644 (file)
@@ -264,8 +264,8 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
     for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) {
       BasicBlock *Succ = TI->getSuccessor(s);
       uint32_t Index = getBBInfo(Succ).Index;
-      for (int i = 0; i < sizeof(uint32_t) / sizeof(char); i++)
-        Indexes.push_back((char)(Index >> (i * sizeof(char))));
+      for (int i = 0; i < 4; i++)
+        Indexes.push_back((char)(Index >> i));
     }
   }
   JC.update(Indexes);