Re: JIT compiling with LLVM v11
| От | Andres Freund | 
|---|---|
| Тема | Re: JIT compiling with LLVM v11 | 
| Дата | |
| Msg-id | 20180308201209.miod2nwy5ivd4fxu@alap3.anarazel.de обсуждение исходный текст  | 
		
| Ответ на | Re: JIT compiling with LLVM v11 (Andres Freund <andres@anarazel.de>) | 
| Ответы | 
                	
            		Re: JIT compiling with LLVM v11
            		
            		 | 
		
| Список | pgsql-hackers | 
On 2018-03-08 11:58:41 -0800, Andres Freund wrote:
> I think we can easily fix this by behaving like clang, which uses
> llvm::sys::getHostCPUFeatures(HostFeatures) to built the feature list:
> 
>   // If -march=native, autodetect the feature list.
>   if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) {
>     if (StringRef(A->getValue()) == "native") {
>       llvm::StringMap<bool> HostFeatures;
>       if (llvm::sys::getHostCPUFeatures(HostFeatures))
>         for (auto &F : HostFeatures)
>           Features.push_back(
>               Args.MakeArgString((F.second ? "+" : "-") + F.first()));
>     }
>   }
> 
> which seems easy enough.
Or even in core LLVM, which has this nice comment:
  // If user asked for the 'native' CPU, we need to autodetect features.
  // This is necessary for x86 where the CPU might not support all the
  // features the autodetected CPU name lists in the target. For example,
  // not all Sandybridge processors support AVX.
  if (MCPU == "native") {
which pretty much describes the issue you're apparently hitting.
I've pushed an attempted fix (needs a comment, but works here).
Greetings,
Andres Freund
		
	В списке pgsql-hackers по дате отправления: