Commit Graph

211694 Commits

Author SHA1 Message Date
Hal Finkel a57b890a33 [PowerPC] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* macros on all PPC cores
We support all __sync_val_compare_and_swap_* builtins (only 64-bit on 64-bit
targets) on all cores, and should define the corresponding
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_* macros, just as GCC does. As it turns out,
this is really important because they're needed to prevent a bad ODR violation
with libstdc++'s std::shared_ptr (this is well explained in PR12730).

We were doing this only for P8, but this is necessary on all PPC systems.

llvm-svn: 249009
2015-10-01 13:39:49 +00:00
Chad Rosier 0b15e7c618 [AArch64] Rename variable to improve readability. NFC.
llvm-svn: 249008
2015-10-01 13:33:31 +00:00
Chad Rosier 7a83d770ae [AArch64] Update comment to reflect reality.
llvm-svn: 249007
2015-10-01 13:09:44 +00:00
Angel Garcia Gomez 90bf895aa3 Prevent loop-convert from leaving empty lines after removing an alias declaration.
Summary: This fixes https://llvm.org/bugs/show_bug.cgi?id=17716.

Reviewers: klimek

Subscribers: cfe-commits, alexfh

Differential Revision: http://reviews.llvm.org/D13342

llvm-svn: 249006
2015-10-01 13:08:21 +00:00
Renato Golin 41106188a4 Revert "Decorating virtual functions load with invariant.load" and fix
This reverts commit r248982 as it was breaking the ARM buildbots and the fix didn't work.
This reverts commit r248984, the fix that didn't work.

llvm-svn: 249005
2015-10-01 12:58:41 +00:00
Zoran Jovanovic 2960f3a346 [mips][microMIPS] Implement CACHEE, WRPGPR and WSBH instructions
Differential Revision: http://reviews.llvm.org/D10337

llvm-svn: 249004
2015-10-01 12:49:27 +00:00
Scott Douglass 290183d734 [ARM] More care with Thumb1 writeback in ARMLoadStoreOptimizer
Differential Revision: http://reviews.llvm.org/D13240

llvm-svn: 249002
2015-10-01 11:56:19 +00:00
Yaron Keren 54bb215fab C++11 rangify for loops, NFC.
llvm-svn: 249001
2015-10-01 11:19:28 +00:00
Johannes Doerfert e46925f324 [FIX] Erase stall results during the SCoP detection
With this patch we erase cached results for regions that are invalid
  as early as possible. If we do not (as before), it is possible that
  two expanded regions will have the same address and the tracked
  results for both are mixed. Currently this would "only" cause
  pessimism in later passes but that will change when we allow invariant
  loads in the SCoP.  Additionally, it triggers non-deterministic
  results as we might dismiss a later region because of results cached
  for an earlier one.

  There is no test case as the problem occurs only non-deterministically.

llvm-svn: 249000
2015-10-01 10:59:14 +00:00
Daniel Jasper e12597cc23 [clang-format] Add support of consecutive declarations alignment
This allows clang-format to align identifiers in consecutive
declarations. This is useful for increasing the readability of the code
in the same way the alignment of assignations is.

The code is a slightly modified version of the consecutive assignment
alignment code. Currently only the identifiers are aligned, and there is
no support of alignment of the pointer star or reference symbol.

The patch also solve the issue of alignments not being possible due to
the ColumnLimit for both the existing AlignConsecutiveAligments and the
new AlignConsecutiveDeclarations.

Patch by Beren Minor, thank you.

Review: http://reviews.llvm.org/D12362
llvm-svn: 248999
2015-10-01 10:06:54 +00:00
Tamas Berghammer 539cd118b2 Trim the output of mktem in PlatformAndroid::DownloadSymbolFile
Differential revision: http://reviews.llvm.org/D13293

llvm-svn: 248998
2015-10-01 09:42:23 +00:00
Alexander Kornienko eef2c237a5 [clang-tidy] fix add_new_check.py
Before this check, I would get the following error:

Updating ./misc/CMakeLists.txt...
Creating ./misc/NoReinterpret_castCheck.h...
Creating ./misc/NoReinterpret_castCheck.cpp...
Updating ./misc/MiscTidyModule.cpp...
Creating ../test/clang-tidy/misc-no-reinterpret_cast.cpp...
Creating ../docs/clang-tidy/checks/misc-no-reinterpret_cast.rst...
Traceback (most recent call last):

File "./add_new_check.py", line 271, in <module>
  main()
File "./add_new_check.py", line 267, in main
  update_checks_list(module_path)
File "./add_new_check.py", line 220, in update_checks_list
  os.listdir('docs/clang-tidy/checks')))
OSError: [Errno 2] No such file or directory: 'docs/clang-tidy/checks'

Patch by Matthias Gehre!

Differential revision: http://reviews.llvm.org/D13272

llvm-svn: 248997
2015-10-01 09:23:20 +00:00
Alexander Kornienko 30c423b1e3 [clang-tidy] Implement FixitHints for identifier references in IdentifierNamingCheck
This diff requires http://reviews.llvm.org/D13079 to be applied first. I wasn't sure about how to make patch series in Phabricator, and I wanted to keep the two separate for clarity.

It looks like that most cases can be supported with this patch. I'm not totally sure about the actual coverage though. I think that the matchers are very generic, but I'm still not totally fluent with the AST.

Patch by Beren Minor!

Differential revision: http://reviews.llvm.org/D13081

llvm-svn: 248996
2015-10-01 09:19:40 +00:00
Pavel Labath 746ffd6980 Revert "Fixing a subtle issue on Mac OS X systems with dSYMs..."
This reverts commit r248985, as it was breaking all remote
expression-evaluating tests (on android at least).

llvm-svn: 248995
2015-10-01 09:03:33 +00:00
Angel Garcia Gomez 2bfb7cbddb Add support for 'cbegin()' and 'cend()' on modernize-loop-convert.
Summary:
This fixes https://llvm.org/bugs/show_bug.cgi?id=22196 .

Also add a non-trivially copyable type to fix some tests that were meant to be about using const-refs, but were changed in r248438.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D13292

llvm-svn: 248994
2015-10-01 08:57:11 +00:00
Eric Fiselier 7362982e62 Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
llvm-svn: 248993
2015-10-01 08:34:37 +00:00
Bruce Mitchener f0248ca545 Add a Post-Build Event on Windows to copy the correct custom Python DLL to the LLDB binaries dir
Summary:
After a developer builds LLDB from source on Windows (assuming they've built it with Python support enabled), they may be somewhat flustered when it fails to launch with a cryptic error.

{F890625}

This happens because Windows can't find python27.dll (or python27_d.dll in case LLDB was built in debug mode). Many developers may have previously installed a release build of Python 2.7 and will not notice anything is amiss when they run a release build of LLDB because Windows will load the python27.dll from one of the system directories or `PATH` (rather than the one that the LLDB build instructions tell them to build). The issue tends to be more pronounced with debug builds of LLDB, since fewer developers probably have python27_d.dll sitting in one of the Windows system directories.

To ensure Windows loads the correct custom built Python DLL when launching LLDB I've added a post-build event that copies the relevant DLL (based on the LLDB build configuration) from `PYTHON_HOME` to the directory in which the LLDB executable is generated.

Patch by Vadim Macagon. Thanks!

Reviewers: brucem, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13237

llvm-svn: 248992
2015-10-01 07:55:44 +00:00
Bruce Mitchener 852cb7fb0d Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator
Summary:
Previously `CMAKE_BUILD_TYPE` was used to determine whether to link in `python27.lib` or `python27_d.lib`, unfortunately this only works reliably when using a CMake generator that generates a single build configuration (e.g. Ninja). The Visual Studio CMake generator generates four build configurations at once (`Debug`, `Release`, `RelWithDebInfo`, `MinSizeRel`), so if `CMAKE_BUILD_TYPE` is set to `Debug` all four build configurations end up linking in `python27_d.lib`, this is clearly undesirable.

To ensure that the correct Python lib is used for each build configuration the value of `PYTHON_LIBRARY` is now determined using generator expressions that evaluate to either the debug or release Python lib. The values of `PYTHON_EXECUTABLE` and `PYTHON_DLL` are now likewise determined using generator expressions.

Note that these changes only apply to the Windows build.

Patch by Vadim Macagon. Thanks!

Reviewers: zturner, brucem

Subscribers: zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D13234

llvm-svn: 248991
2015-10-01 07:47:38 +00:00
Bruce Mitchener c32c277b84 Include platform agnostic <HostGetOpt.h> in the place of <getopt.h>
Summary: Problem caught on NetBSD with missing getopt_long_only(3).

Change by Kamil Rytarowski <n54@gmx.com>

Reviewers: joerg, brucem

Subscribers: brucem, lldb-commits

Differential Revision: http://reviews.llvm.org/D12748

llvm-svn: 248990
2015-10-01 07:45:58 +00:00
Eric Fiselier d866bdd692 Manually suppress -Wnonnull when it occurs in an unevaluated context
llvm-svn: 248989
2015-10-01 07:41:07 +00:00
Eric Fiselier 5c736fe9ab Fix initialzation order in dynarray
llvm-svn: 248988
2015-10-01 07:29:38 +00:00
Eric Fiselier b4e2e7a292 Suppress array initialization warnings in std::experimental::apply tests
llvm-svn: 248987
2015-10-01 07:05:38 +00:00
Eric Fiselier f74bb3b8b0 Dont link -lrt in the testsuite on linux unless using sanitizers.
llvm-svn: 248986
2015-10-01 06:15:26 +00:00
Jason Molenda 8b2f23d515 Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
introduced by r235737 but I didn't look into it too closely).

A dSYM can have a per-UUID plist in it which tells lldb where
to find an executable binary for the dSYM (DBGSymbolRichExecutable)
- other information can be included in this plist, like how to
remap the source file paths from their build pathnames to their
long-term storage pathnames.

This per-UUID plist is a unusual; it is used probably exclusively
inside apple with our build system.  It is not created by default
in normal dSYMs.

The problem was like this:

  1. lldb wants to find an executable, given only a UUID
     (this happens when lldb is doing cross-host debugging
      and doesn't have a copy of the target system's binaries)

  2. It eventually calls LocateMacOSXFilesUsingDebugSymbols
     which does a spotlight search for the dSYM on the local
     system, and failing that, tries the DBGShellCommands
     command to find the dSYM.

  3. It gets a dSYM.  It reads the per-UUID plist in the dSYM.
     The dSYM has a DBGSymbolRichExecutable kv pair pointing to
     the binary on a network filesystem.

  4. Using the binary on the network filesystem, lldb now goes
     to find the dSYM.

  5. It starts by looking for a dSYM next to the binary it found.

  6. lldb is now reading the dSYM over a network filesystem,
     ignoring the one it found on its local filesystem earlier.

Everything still *works* but it's much slower.

This would be a tricky one to write up in a testsuite case;
you really need the binary to not exist on the local system.
And LocateMacOSXFilesUsingDebugSymbols will only compile on
Mac OS X - even if I found a way to write up a test case, it
would not run anywhere but on a mac.

One change Greg wanted while I was touching this code was to
have LocateMacOSXFilesUsingDebugSymbols (which could be asked
to find a binary OR find a dSYM) to instead return a ModuleSpec
with the sum total of everything it could find.  This
change of passing around a ModuleSpec instead of a FileSpec
was percolated up into ModuleList::GetSharedModule.

The changes to LocateMacOSXFilesUsingDebugSymbols look larger
than they really are - there's a lot of simple whitespace changes
in there.

I ran the testsuites on mac, no new regressions introduced

<rdar://problem/21993813> 

llvm-svn: 248985
2015-10-01 05:37:22 +00:00
Piotr Padlewski aca0e58caa Test fix
llvm-svn: 248984
2015-10-01 04:19:45 +00:00
Jingyue Wu df1a1b113b [NaryReassociate] SeenExprs records WeakVH
Summary:
The instructions SeenExprs records may be deleted during rewriting.
FindClosestMatchingDominator should ignore these deleted instructions.

Fixes PR24301.

Reviewers: grosser

Subscribers: grosser, llvm-commits

Differential Revision: http://reviews.llvm.org/D13315

llvm-svn: 248983
2015-10-01 03:51:44 +00:00
Piotr Padlewski 551c814e48 Decorating virtual functions load with invariant.load
http://reviews.llvm.org/D13279

llvm-svn: 248982
2015-10-01 03:50:41 +00:00
Keno Fischer 17433bd102 Fix performance problem in long-running SectionMemoryManagers
Summary:
Without this patch, the memory manager would call `mprotect` on every memory
region it ever allocated whenever it wanted to finalize memory (i.e. not just
the ones it just allocated). This caused terrible performance problems for
long running memory managers. In one particular compile heavy julia benchmark,
we were spending 50% of time in `mprotect` if running under MCJIT.

Fix this by splitting allocated memory blocks into those on which memory
permissions have been set and those on which they haven't and only running
`mprotect` on the latter.

Reviewers: lhames

Subscribers: reames, llvm-commits

Differential Revision: http://reviews.llvm.org/D13156

llvm-svn: 248981
2015-10-01 02:45:07 +00:00
Chandler Carruth 9143378db0 Patch over a really horrible bug in our vector builtins that showed up
recently when we started using direct conversion to model sign
extension. The __v16qi type we use for SSE v16i8 vectors is defined in
terms of 'char' which may or may not be signed! This causes us to
generate pmovsx and pmovzx depending on the setting of -funsigned-char.

This patch just forms an explicitly signed type and uses that to
formulate the sign extension. While this gets the correct behavior
(which we now verify with the enhanced test) this is just the tip of the
ice berg. Now that I know what to look for, I have found errors of this
sort *throughout* our vector code. Fortunately, this is the only
specific place where I know of users actively having their code
miscompiled by Clang due to this, so I'm keeping the fix for those users
minimal and targeted.

I'll be sending a proper email for discussion of how to fix these
systematically, what the implications are, and just how widely broken
this is... From what I can tell, we have never shipped a correct set of
builtin headers for x86 when users rely on -funsigned-char. Oops.

llvm-svn: 248980
2015-10-01 02:21:34 +00:00
Vedant Kumar f7ed23f744 [compiler-rt] Fix build (again) by wrapping lines to 80 chars (NFC)
llvm-svn: 248979
2015-10-01 02:15:40 +00:00
Tom Stellard 1f0e7bbc5b AMDGPU/SI: Re-order PreloadedValue enum and number entries based on init order
Reviewers: arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D12451

llvm-svn: 248978
2015-10-01 02:02:46 +00:00
Cameron Esfahani 3c55f2cd96 createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path.
Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.

Summary: Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.

Reviewers: rsmith, akyrtzi

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12774

llvm-svn: 248977
2015-10-01 01:24:59 +00:00
Davide Italiano c50ae36509 [llvm-objdump] Fix time of check to time of use bug.
There's already a test that covers this situation, so we should be
fine.

llvm-svn: 248976
2015-10-01 01:02:37 +00:00
Bob Wilson 1f24ea15d0 Fix printing of parameterized Objective-C interfaces.
This change was accidentally omitted from Doug's change in r241541.

llvm-svn: 248975
2015-10-01 00:53:13 +00:00
Adrian Prantl fd69611c8e Module debugging: Emit Objective-C interfaces in their module scope when
building a clang module.

llvm-svn: 248974
2015-10-01 00:48:51 +00:00
Vedant Kumar f997bd88d7 [compiler-rt] Fix build by wrapping lines to 80 chars (NFC)
llvm-svn: 248973
2015-10-01 00:48:07 +00:00
David Blaikie 74d8806635 Revert "Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean"
This reverts commit r248963.

Seems there's some standard libraries (and libcxxabi implementations)
that aren't -Wdeprecated clean... hrm.

llvm-svn: 248972
2015-10-01 00:44:21 +00:00
Sean Callanan 0f625f42fd Use the preferred display language when making a persistent variable from a
ValueObject.

llvm-svn: 248971
2015-10-01 00:39:03 +00:00
Sean Callanan 7aeb7e256b Changed PersistentExpressionState to allow symbol lookups. Clang doesn't
report any (yet).

llvm-svn: 248970
2015-10-01 00:38:06 +00:00
Rui Ueyama 1c8092c915 ELF2: Tidy up Options.td.
Fix indentation and sort options alphabetically.

llvm-svn: 248969
2015-10-01 00:33:02 +00:00
Dehao Chen 7c41dd6498 Update sample profile propagation algorithm.
http://reviews.llvm.org/D13218

llvm-svn: 248968
2015-10-01 00:26:56 +00:00
Rui Ueyama 5d8ef2cbd8 ELF2: Ignore some command line argument that clang passes to the linker.
llvm-svn: 248967
2015-10-01 00:24:54 +00:00
Vedant Kumar 59ba7b8cd1 [compiler-rt] Apply modernize-use-nullptr fixes in sanitizers
- Trim spaces.
- Use nullptr in place of 0 for pointer variables.
- Use '!p' in place of 'p == 0' for null pointer checks.
- Add blank lines to separate function definitions.
- Add 'extern "C"' or 'namespace foo' comments after the appropriate
  closing brackets

This is a continuation of work from 409b7b82. The focus here is on the
various sanitizers (not sanitizer_common, as before).

Patch by Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D13225

llvm-svn: 248966
2015-10-01 00:22:21 +00:00
Ahmed Bougacha 23a0d1a1d6 [X86] Don't custom-lower vNi32 uint_to_fp when unsafe-fp-math.
The custom code produces incorrect results if later reassociated.

Since r221657, on x86, vNi32 uitofp is lowered using an optimized
sequence:

  movdqa LCPI0_0(%rip), %xmm1 ## xmm1 = [65535, ...]
  pand %xmm0, %xmm1
  por LCPI0_1(%rip), %xmm1 ## [0x4b000000, ...]
  psrld $16, %xmm0
  por LCPI0_2(%rip), %xmm0 ## [0x53000000, ...]
  addps LCPI0_3(%rip), %xmm0 ## [float -5.497642e+11, ...]
  addps %xmm1, %xmm0

Since r240361, the machine combiner opportunistically reassociates
2-instruction sequences (with -ffast-math). In the new code sequence,
the ADDPS' are eligible. In isolation, for simple examples (without
reassociable users), this makes no performance difference (the goal
being to enable reassociation of longer chains).

In the trivial example (just one uitofp), the reassociation doesn't
happen, because (I think) it would require the emission of a separate
movaps for a constantpool load (instead of folding it into addps).

However, when we have multiple uitofp sequences, and the constantpool
loads are CSE'd earlier, the machine combiner can do the reassociation.

When the ADDPS' are reassociated, the resulting sequence isn't correct
anymore, as we'd be adding large (2**39) constants with comparatively
smaller values (~2**23). Given that two of the three inputs are powers
of 2 larger than 2**16, and that ulp(2**39) == 2**(39-24) == 2**15,
the reassociated chain will produce 0 for any input in [0, 2**14[.
In my testing, it also produces wrong results for 99.5% of [0, 2**32[.

Avoid this by disabling the new lowering when -ffast-math. It does
mean that we'll get slower code than without it, but at least we
won't get egregiously incorrect code.

One might argue that, considering -ffast-math is all but meaningless,
uitofp producing wrong results isn't a compiler bug. But it really is.

Fixes PR24512.

...though this is really more of a workaround.
Ideally, we'd have some sort of Machine FMF, but that's a problem
that's not worth tackling until we do more with machine IR.

llvm-svn: 248965
2015-10-01 00:11:07 +00:00
Vedant Kumar 552c0111f1 [sanitizer_common] Apply modernize-use-nullptr, other minor fixes
- Trim spaces.
- Use nullptr in place of 0 for pointer variables.
- Use '!p' in place of 'p == 0' for null pointer checks.

Patch by Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D13310

llvm-svn: 248964
2015-09-30 23:52:54 +00:00
David Blaikie 3830d68bc1 Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean
This particularly helps enforce the C++ Rule of 5 (for new move ops this
is already an error, but for a type only using C++98 features (copy
ctor/assign, dtor) it is only deprecated, not invalid)

Applying the flag for any GCC compatible compiler - GCC doesn't warn on
the Rule of 5 cases that C++11 deprecates, but it doesn't have other
false positives so far as I could see (compiling with GCC 4.8 didn't
produce any -Wdeprecated warnings I could spot).

Reviewers: aaron.ballman

Differential Revision: http://reviews.llvm.org/D13314

llvm-svn: 248963
2015-09-30 23:36:12 +00:00
Evgeniy Stepanov 25c58d124b [asan] Fix asan_symbolize.py handling of non-existing paths
llvm-svn: 248962
2015-09-30 23:17:39 +00:00
Rui Ueyama 819f7127c0 ELF2: Move tests for linker script from basic.s to linkerscript.s.
llvm-svn: 248961
2015-09-30 23:15:35 +00:00
Enrico Granata 6754e04f6d Introudce a IsTopLevelFunction() API on Language and Function
This is meant to support languages that have a scripting mode with top-level code that acts as global

For now, this flag only controls whether 'frame variable' will attempt to treat globals as locals when within such a function

llvm-svn: 248960
2015-09-30 23:12:22 +00:00
Reid Kleckner 6dec87a8a0 [WinEH] Emit int3 after noreturn calls on Win64
The Win64 unwinder disassembles forwards from each PC to try to
determine if this PC is in an epilogue. If so, it skips calling the EH
personality function for that frame. Typically, this means you cannot
catch an exception in the same frame that you threw it, because 'throw'
calls a noreturn runtime function.

Previously we avoided this problem with the TrapUnreachable
TargetOption, but that's a much bigger hammer than we need. All we need
is a 1 byte non-epilogue instruction right after the call.  Instead,
what we got was an unconditional branch to a shared block containing the
ud2, potentially 7 bytes instead of 1. So, this reverts r206684, which
added TrapUnreachable, and replaces it with something better.

The new code pattern matches for invoke/call followed by unreachable and
inserts an int3 into the DAG. To be 100% watertight, we would need to
insert SEH_Epilogue instructions into all basic blocks ending in a call
with no terminators or successors, but in practice this is unlikely to
come up.

llvm-svn: 248959
2015-09-30 23:09:23 +00:00