r228236 - Driver: Stop forcing frame pointer usage on Windows

Reid Kleckner rnk at google.com
Tue Feb 17 14:43:18 PST 2015


Should be fixed in r229575. It took me a while to clear up the other
unrelated check-asan failures on my system.

On Fri, Feb 6, 2015 at 8:11 AM, Timur Iskhodzhanov <timurrrr at google.com>
wrote:

> ping
>
> Thu Feb 05 2015 at 4:53:30 PM, Timur Iskhodzhanov <timurrrr at google.com>:
>
> Interesting: this has broken down the dll_noreturn ASan tests (run as part
>> of check-asan and check-asan-dynamic), which uses -O0 (yes, o-zero).
>> Can you please make sure this doesn't affect -O0?
>>
>>
>> On Thu Feb 05 2015 at 2:52:57 AM Reid Kleckner <reid at kleckner.net> wrote:
>>
>>> Author: rnk
>>> Date: Wed Feb  4 17:45:07 2015
>>> New Revision: 228236
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=228236&view=rev
>>> Log:
>>> Driver: Stop forcing frame pointer usage on Windows
>>>
>>> Previously, we would use a frame pointer by default on non-Linux OSs. On
>>> Linux, any optimization flags imply -fomit-frame-pointer. XCore always
>>> defaulted to -fomit-frame-pointer.
>>>
>>> Now x86 Windows matches our behavior on Linux. All other ISAs supported
>>> by Windows (ARM, x64) use xdata information, and frame pointers aren't
>>> useful. Frame pointers are now off by default for such targets, but can
>>> be forced via -fno-omit-frame-pointer and code using alloca().
>>>
>>> In fact, on Win64 our frame-pointer prologue is not describable with
>>> UNWIND_INFO. This change is a workaround to avoid using the broken FP
>>> using prologue for most functions. This is PR22467.
>>>
>>> Modified:
>>>     cfe/trunk/lib/Driver/Tools.cpp
>>>
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>>> ls.cpp?rev=228236&r1=228235&r2=228236&view=diff
>>> ============================================================
>>> ==================
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Wed Feb  4 17:45:07 2015
>>> @@ -2288,27 +2288,49 @@ static bool addSanitizerRuntimes(const T
>>>    return !StaticRuntimes.empty();
>>>  }
>>>
>>> +static bool areOptimizationsEnabled(const ArgList &Args) {
>>> +  // Find the last -O arg and see if it is non-zero.
>>> +  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
>>> +    return !A->getOption().matches(options::OPT_O0);
>>> +  // Defaults to -O0.
>>> +  return false;
>>> +}
>>> +
>>>  static bool shouldUseFramePointerForTarget(const ArgList &Args,
>>>                                             const llvm::Triple &Triple) {
>>> -  switch (Triple.getArch()) {
>>> -  // Don't use a frame pointer on linux if optimizing for certain
>>> targets.
>>> -  case llvm::Triple::mips64:
>>> -  case llvm::Triple::mips64el:
>>> -  case llvm::Triple::mips:
>>> -  case llvm::Triple::mipsel:
>>> -  case llvm::Triple::systemz:
>>> -  case llvm::Triple::x86:
>>> -  case llvm::Triple::x86_64:
>>> -    if (Triple.isOSLinux())
>>> -      if (Arg *A = Args.getLastArg(options::OPT_O_Group))
>>> -        if (!A->getOption().matches(options::OPT_O0))
>>> -          return false;
>>> -    return true;
>>> -  case llvm::Triple::xcore:
>>> +  // XCore never wants frame pointers, regardless of OS.
>>> +  if (Triple.getArch() == llvm::Triple::xcore) {
>>>      return false;
>>> -  default:
>>> -    return true;
>>>    }
>>> +
>>> +  if (Triple.isOSLinux()) {
>>> +    switch (Triple.getArch()) {
>>> +    // Don't use a frame pointer on linux if optimizing for certain
>>> targets.
>>> +    case llvm::Triple::mips64:
>>> +    case llvm::Triple::mips64el:
>>> +    case llvm::Triple::mips:
>>> +    case llvm::Triple::mipsel:
>>> +    case llvm::Triple::systemz:
>>> +    case llvm::Triple::x86:
>>> +    case llvm::Triple::x86_64:
>>> +      return !areOptimizationsEnabled(Args);
>>> +    default:
>>> +      return true;
>>> +    }
>>> +  }
>>> +
>>> +  if (Triple.isOSWindows()) {
>>> +    switch (Triple.getArch()) {
>>> +    case llvm::Triple::x86:
>>> +      return !areOptimizationsEnabled(Args);
>>> +    default:
>>> +      // All other supported Windows ISAs use xdata unwind information,
>>> so frame
>>> +      // pointers are not generally useful.
>>> +      return false;
>>> +    }
>>> +  }
>>> +
>>> +  return true;
>>>  }
>>>
>>>  static bool shouldUseFramePointer(const ArgList &Args,
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150217/5eeee55e/attachment.html>


More information about the cfe-commits mailing list