[llvm] r327761 - [GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA for

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 17:03:05 PDT 2018


On 03/16/2018 04:51 PM, Chandler Carruth via llvm-commits wrote:
> Author: chandlerc
> Date: Fri Mar 16 16:51:33 2018
> New Revision: 327761
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=327761&view=rev

Hi Chandler,

Is this a candidate for 6.0.1?

-Tom

> Log:
> [GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA for
> a long time.
> 
> The key thing is that we need to create value handles for every function
> that we create a `FunctionInfo` object around. Without this, when that
> function is deleted we can end up creating a new function that collides
> with its address and look up a stale AA result. With that AA result we
> can in turn miscompile code in ways that break.
> 
> This is seriously one of the most absurd miscompiles I've seen. It only
> reproduced for us recently and only when building a very large server
> with both ThinLTO and PGO.
> 
> A *HUGE* shout out to Wei Mi who tracked all of this down and came up
> with this patch. I'm just landing it because I happened to still by at
> a computer.
> 
> He or I can work on crafting a test case to hit this (now that we know
> what to target) but it'll take a while, and we've been chasing this for
> a long time and need it fix Right Now.
> 
> Modified:
>     llvm/trunk/lib/Analysis/GlobalsModRef.cpp
> 
> Modified: llvm/trunk/lib/Analysis/GlobalsModRef.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/GlobalsModRef.cpp?rev=327761&r1=327760&r2=327761&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/GlobalsModRef.cpp (original)
> +++ llvm/trunk/lib/Analysis/GlobalsModRef.cpp Fri Mar 16 16:51:33 2018
> @@ -502,6 +502,8 @@ void GlobalsAAResult::AnalyzeCallGraph(C
>      }
>  
>      FunctionInfo &FI = FunctionInfos[F];
> +    Handles.emplace_front(*this, F);
> +    Handles.front().I = Handles.begin();
>      bool KnowNothing = false;
>  
>      // Collect the mod/ref properties due to called functions.  We only compute
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list