[llvm] r254028 - [PGO] Fix build errors in x86_64-darwin

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 15:18:39 PST 2015


On Tue, Nov 24, 2015 at 1:55 PM, Rong Xu via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: xur
> Date: Tue Nov 24 15:55:50 2015
> New Revision: 254028
>
> URL: http://llvm.org/viewvc/llvm-project?rev=254028&view=rev
> Log:
> [PGO] Fix build errors in x86_64-darwin
>
> Fix buildbot failure for x86_64-darwin due to r254021
>
> Modified:
>     llvm/trunk/lib/Transforms/Instrumentation/CFGMST.h
>     llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/CFGMST.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/CFGMST.h?rev=254028&r1=254027&r2=254028&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/CFGMST.h (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/CFGMST.h Tue Nov 24 15:55:50
> 2015
> @@ -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;
>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=254028&r1=254027&r2=254028&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Tue
> Nov 24 15:55:50 2015
> @@ -264,8 +264,8 @@ void FuncPGOInstrumentation<Edge, BBInfo
>      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));
>

This doesn't seem correct. It seems like it does not incorporate all the
bytes of `Index`. I think what you want is to use the CHAR_BIT macro here,
or hardcode it to 8.

-- Sean Silva


>      }
>    }
>    JC.update(Indexes);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151124/67b417f1/attachment.html>


More information about the llvm-commits mailing list