Commit Graph

211205 Commits

Author SHA1 Message Date
Artem Belevich 7d6266ead3 Disabled one of the test runs in cuda-detect.cu
--sysroot apparently can't handle long paths which triggers test
failure on some platforms.

llvm-svn: 248448
2015-09-24 00:15:47 +00:00
Rui Ueyama ffc9b444a4 Add iterator_range::end() predicate.
llvm-svn: 248447
2015-09-23 23:58:29 +00:00
Devin Coughlin 683dfd3124 [analyzer] Discard malloc-overflow bug-report when a known size is malloc'ed.
This patch ignores malloc-overflow bug in two cases:
Case1:
x = a/b; where n < b
malloc (x*n); Then x*n will not overflow.

Case2:
x = a; // when 'a' is a known value.
malloc (x*n);

Also replaced isa with dyn_cast.

Reject multiplication by zero cases in MallocOverflowSecurityChecker
Currently MallocOverflowSecurityChecker does not catch cases like:
malloc(n * 0 * sizeof(int));

This patch rejects such cases.

Two test cases added. malloc-overflow2.c has an example inspired from a code
in linux kernel where the current checker flags a warning while it should not.

A patch by Aditya Kumar!

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

llvm-svn: 248446
2015-09-23 23:27:55 +00:00
Michael Zolotukhin d56ee06d1f [Unroll] When completely unrolling the loop, replace conditinal branches with unconditional.
Nothing is expected to change, except we do less redundant work in
clean-up.

Reviewers: hfinkel

Subscribers: llvm-commits

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

llvm-svn: 248444
2015-09-23 23:12:43 +00:00
Chris Bieneman 01ebf004ff [CMake] [Darwin] Bug 21562 - Add a CMake equivalent for make/platform/clang_darwin.mk in compiler_rt
Summary: First pass at adding cc_kext_* builtin libraries. I need to cleanup and refactor the builtin filtering so that I can use it to filter the builtin symbols list, but this is the first step in the right direction.

Reviewers: bob.wilson, bogner, samsonov

Subscribers: llvm-commits

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

llvm-svn: 248443
2015-09-23 23:05:32 +00:00
Chris Bieneman 25bc0debf3 [darwin] [builtins] Stop generating cc_kext_ios5 and move iOS architectures out of cc_kext into cc_kext_ios
Summary:
This corresponds to a patch to compiler-rt (D13112).

Xcode 7 doesn't support targeting iOS5 and earlier. Instead of just dropping cc_kext_ios5, I've repurposed it to cc_kext_ios, and I'm pulling the iOS architectures out of cc_kext. Putting OS X and iOS slices inside the same archive was just odd.

Reviewers: bogner, bob.wilson

Subscribers: cfe-commits

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

llvm-svn: 248442
2015-09-23 22:52:35 +00:00
Chris Bieneman eb71c99684 [darwin] [builtins] Stop generating cc_kext_ios5 and move iOS architectures out of cc_kext into cc_kext_ios
Summary:
Xcode 7 doesn't support targeting iOS5 and earlier. Instead of just dropping cc_kext_ios5, I've repurposed it to cc_kext_ios, and I'm pulling the iOS architectures out of cc_kext. Putting OS X and iOS slices inside the same archive was just odd.

There is a cooresponding clang change coming too.

Reviewers: bogner, bob.wilson

Subscribers: llvm-commits

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

llvm-svn: 248441
2015-09-23 22:52:26 +00:00
Wei Mi 3cc9204a52 Put profile variables of COMDAT functions to it's own COMDAT group.
In -fprofile-instr-generate compilation, to remove the redundant profile
variables for the COMDAT functions, these variables are placed in the same
COMDAT group as its associated function. This way when the COMDAT function
is not picked by the linker, those profile variables will also not be
output in the final binary. This may cause warning when mix link objects
built w and wo -fprofile-instr-generate.

This patch puts the profile variables for COMDAT functions to its own COMDAT
group to avoid the problem.

Patch by xur.
Differential Revision: http://reviews.llvm.org/D12248

llvm-svn: 248440
2015-09-23 22:40:45 +00:00
Sanjay Patel 13e8bbc237 set div/rem default values to 'expensive' in TargetTransformInfo's cost model
...because that's what the cost model was intended to do.

As discussed in D12882, this fix has a temporary unintended consequence for
SimplifyCFG: it causes us to not speculate an fdiv. However, two wrongs make
PR24818 right, and two wrongs make PR24343 act right even though it's really
still wrong.

I intend to correct SimplifyCFG and add to CodeGenPrepare to account for this
cost model change and preserve the righteousness for the bug report cases.

https://llvm.org/bugs/show_bug.cgi?id=24818
https://llvm.org/bugs/show_bug.cgi?id=24343

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

llvm-svn: 248439
2015-09-23 22:28:18 +00:00
Manuel Klimek b457b68f8d Fix loop-convert for trivially copyable types.
Previously, we would rewrite:
void f(const vector<int> &v) {
  for (size_t i = 0; i < v.size(); ++i) {
to
  for (const auto &elem : v) {

Now we rewrite it to:
  for (auto elem : v) {
(and similarly for iterator based loops).

llvm-svn: 248438
2015-09-23 22:28:14 +00:00
Tim Northover beb5bccf88 ARM: fix folding stack adjustment (again again again...)
This time, the issue is that we weren't accounting for the possibility that
aligned DPRs could have been stored after the final "push" in a prologue. When
that happened we effectively moved a "sub sp, #N" from below the aligned stores
to above them, and everything went to pot.

To make it worse, I'd actually committed something testing that we produced
wrong code, so the test update is tiny.

llvm-svn: 248437
2015-09-23 22:21:09 +00:00
John McCall 6997525eaa Forbid qualifiers on ObjC generic parameters and arguments, but
silently ignore them on arguments when they're provided indirectly
(.e.g behind a template argument or typedef).

This is mostly just good language design --- specifying that a
generic argument is __weak doesn't actually do anything --- but
it also prevents assertions when trying to apply a different
ownership qualifier.

rdar://21612439

llvm-svn: 248436
2015-09-23 22:14:21 +00:00
Richard Smith d209967a68 Remove warning on over-wide bit-field of boolean type; there's no risk that
someone thought all the bits would be value bits in this case.

Also fix the wording of the warning -- it claimed that the width of 'bool' is
8, which is not correct; the width is 1 bit, whereas the size is 8 bits in our
implementation.

llvm-svn: 248435
2015-09-23 22:07:44 +00:00
Ying Chen d93aa1060a Check existence of SIGHUP before using it
Summary: -SIGHUP doesn't exist on Windows

Reviewers: tfiala

Subscribers: lldb-commits

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

llvm-svn: 248434
2015-09-23 21:53:18 +00:00
Artem Belevich 98607b6757 [CUDA] Added CUDA installation detector class.
Added new option --cuda-path=<path> which allows
overriding default search paths.
If it's not specified we look for CUDA installation in
/usr/include/cuda and /usr/include/cuda-7.0.

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

llvm-svn: 248433
2015-09-23 21:49:39 +00:00
Devin Coughlin 9f21f68bfe [analyzer] Improve localizability checks for iOS / OS X.
Various improvements to the localization checker:
* Adjusted copy to be consistent with diagnostic text in other Apple
  API checkers.
* Added in ~150 UIKit / AppKit methods that require localized strings in
  UnlocalizedStringsChecker.
* UnlocalizedStringChecker now checks for UI methods up the class hierarchy and
  UI methods that conform for a certain Objective-C protocol.
* Added in alpha version of PluralMisuseChecker and some regression tests. False
  positives are still not ideal.

(This is the second attempt, with the memory issues on Linux resolved.)

A patch by Kulpreet Chilana!

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

llvm-svn: 248432
2015-09-23 21:43:21 +00:00
Richard Smith d784e6893c PR14858: Initial support for proper sizeof... handling within alias templates.
This doesn't quite get alias template equivalence right yet, but handles the
egregious cases where we would silently give the wrong answers.

llvm-svn: 248431
2015-09-23 21:41:42 +00:00
Richard Smith ed9b8f0a37 Remove wrong implication that value-dependent implies instantiation-dependent,
and fix the only code that was depending on this so that it sets all the
relevant flags appropriately.

No functionality change intended.

llvm-svn: 248430
2015-09-23 21:30:47 +00:00
Enrico Granata d188803f45 The Visual Studio compiler does not like this C-ism when 'enum class'es are involved
llvm-svn: 248429
2015-09-23 20:49:15 +00:00
Adrian Prantl ea8a724474 dsymutil: Don't prune forward declarations inside a module definition.
llvm-svn: 248428
2015-09-23 20:44:37 +00:00
Enrico Granata 15a67f49aa Make the ObjCLanguageRuntimes comply with llvm-style RTTI
llvm-svn: 248427
2015-09-23 20:12:19 +00:00
Joerg Sonnenberger 27a69a2ba0 Support linking against OpenMP runtime on NetBSD.
llvm-svn: 248426
2015-09-23 20:11:00 +00:00
Rafael Espindola cdfecffd80 Add support for relocating R_X86_64_GOTPCREL.
llvm-svn: 248425
2015-09-23 20:08:25 +00:00
Joerg Sonnenberger 5c3f9d516d Push OpenMP linker flags after linker input on Darwin. Don't add any
libraries if -nostdlib is specified. Test.

llvm-svn: 248424
2015-09-23 20:07:56 +00:00
Adrian Prantl 209c424d1e Fix this dsymutil testcase by not passing in a path to the modulemap file,
so the lookup works as expected after prepending the oso-prepend-path.

This manifested only on Windows, because "/" is not a relative path there.

llvm-svn: 248423
2015-09-23 19:53:10 +00:00
Philip Reames d63df5107e Remove handling of AddrSpaceCast in stripAndAccumulateInBoundsConstantOffsets
Patch by: simoncook

Unlike BitCasts, AddrSpaceCasts do not always produce an output the same size as its input, which was previously assumed. This fixes cases where two address spaces do not have the same size pointer, as an assertion failure would occur when trying to prove deferenceability.  LoopUnswitch is used in the particular test, but LICM also exhibits the same problem.

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

llvm-svn: 248422
2015-09-23 19:48:43 +00:00
Enrico Granata e5ffa089cc Revert 248366 "Testcase and fix for bug 24074"
This commit introduced regressions in several test cases on FreeBSD and Mac OS X

llvm-svn: 248421
2015-09-23 19:32:56 +00:00
Lawrence Hu cac0b89289 Swap loop invariant GEP with loop variant GEP to allow more LICM.
This patch changes the order of GEPs generated by Splitting GEPs
    pass, specially when one of the GEPs has constant and the base is
    loop invariant, then we will generate the GEP with constant first
    when beneficial, to expose more cases for LICM.

    If originally Splitting GEP generate the following:
      do.body.i:
        %idxprom.i = sext i32 %shr.i to i64
        %2 = bitcast %typeD* %s to i8*
        %3 = shl i64 %idxprom.i, 2
        %uglygep = getelementptr i8, i8* %2, i64 %3
        %uglygep7 = getelementptr i8, i8* %uglygep, i64 1032
      ...
    Now it genereates:
      do.body.i:
        %idxprom.i = sext i32 %shr.i to i64
        %2 = bitcast %typeD* %s to i8*
        %3 = shl i64 %idxprom.i, 2
        %uglygep = getelementptr i8, i8* %2, i64 1032
        %uglygep7 = getelementptr i8, i8* %uglygep, i64 %3
      ...

    For no-loop cases, the original way of generating GEPs seems to
    expose more CSE cases, so we don't change the logic for no-loop
    cases, and only limit our change to the specific case we are
    interested in.

llvm-svn: 248420
2015-09-23 19:25:30 +00:00
Akira Hatanaka f6afd11538 [InstCombine] Preserve metadata when merging loads that are phi
arguments.

Make sure InstCombiner::FoldPHIArgLoadIntoPHI doesn't drop the following
metadata:

MD_tbaa
MD_alias_scope
MD_noalias
MD_invariant_load
MD_nonnull
MD_range

rdar://problem/17617709

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

llvm-svn: 248419
2015-09-23 18:40:57 +00:00
Manuel Klimek 143b644238 Fix loop-convert for const references to containers.
Previously we would use a non-const loop variable in the range-based
loop for:
void f(const std::vector<int> &v) {
  for (size_t i = 0; i < v.size(); ++i) {
Now we use const auto&.

Note that we'll also want to use a copy at least for simple types.

llvm-svn: 248418
2015-09-23 18:40:47 +00:00
Philip Reames e144025652 [docs] Update DominatorTree docs to clarify expectations around unreachable blocks
Note: I'm am not trying to describe what "should be"; I'm only describing what is true today.

This came out of my recent question to llvm-dev titled: When can the dominator tree not contain a node for a basic block?

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

llvm-svn: 248417
2015-09-23 18:39:37 +00:00
Siva Chandra 4327d7aa12 [TestCppIncompleteTypes] Fix Makefile to handle different archs.
Reviewers: chying

Subscribers: lldb-commits

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

llvm-svn: 248416
2015-09-23 18:36:39 +00:00
Sanjay Patel 1a6534661b [x86] replace integer 'xor' ops with packed SSE FP 'xor' ops when operating on FP scalars
Turn this:

movd %xmm0, %eax
movd %xmm1, %ecx
xorl %eax, %ecx
movd %ecx, %xmm0

into this:

xorps %xmm1, %xmm0

This is related to, but does not solve:
https://llvm.org/bugs/show_bug.cgi?id=22428

This is an extension of:
http://reviews.llvm.org/rL248395

llvm-svn: 248415
2015-09-23 18:33:42 +00:00
Ed Maste c6dd651518 Handle new types in ClangASTContext::GetEncoding
And remove the switch default, so that the -Wcovered-switch-default
warning will catch new types next time they're added.

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

llvm-svn: 248414
2015-09-23 18:32:34 +00:00
Artem Belevich 8d20bd3917 Reverted r248408 "[CUDA] Added CUDA installation detector class."
because included test fails on some platforms.

llvm-svn: 248413
2015-09-23 18:28:30 +00:00
Rafael Espindola c2d211994d Create the .bss section early so that we don't have to set it after the fact.
llvm-svn: 248412
2015-09-23 18:25:05 +00:00
Ed Maste 9b597c7a1e Remove expectedFailureFreeBSD from passing test
ClassTypesTestCase::test_with_dwarf_and_constructor_name

llvm.org/pr14540

llvm-svn: 248411
2015-09-23 18:23:38 +00:00
Ed Maste 00719f5dec Remove expectedFailureFreeBSD from passing TestChangeValueAPI test
This test used fail intermittently, but now passes consistently on
FreeBSD in local runs. We'll investigate further if it's intermittent
on the FreeBSD buildbot, once it's restored.

llvm.org/pr15039

llvm-svn: 248410
2015-09-23 18:20:51 +00:00
Sanjay Patel aba37553c4 [x86] replace integer 'or' ops with packed SSE FP 'or' ops when operating on FP scalars
Turn this:

movd %xmm0, %eax
movd %xmm1, %ecx
orl %eax, %ecx
movd %ecx, %xmm0

into this:

orps %xmm1, %xmm0

This is related to, but does not solve:
https://llvm.org/bugs/show_bug.cgi?id=22428

This is an extension of:
http://reviews.llvm.org/rL248395

llvm-svn: 248409
2015-09-23 18:19:07 +00:00
Artem Belevich e75405b4ea [CUDA] Added CUDA installation detector class.
Added new option --cuda-path=<path> which allows
overriding default search paths.
If it's not specified we look for CUDA installation in
/usr/include/cuda and /usr/include/cuda-7.0.

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

llvm-svn: 248408
2015-09-23 18:13:25 +00:00
Jonathan Peyton 1acc2dbf6e Update Reference.pdf files.
This updates the Reference.pdf files to say LLVM OpenMP Runtime Library and
also updates the build documentation to show how to build with CMake.

llvm-svn: 248407
2015-09-23 18:09:47 +00:00
Adrian Prantl 4c36e2f47e Fix the order of operations.
llvm-svn: 248406
2015-09-23 18:09:01 +00:00
Evgeniy Stepanov a2002b08f7 Android support for SafeStack.
Add two new ways of accessing the unsafe stack pointer:

* At a fixed offset from the thread TLS base. This is very similar to
  StackProtector cookies, but we plan to extend it to other backends
  (ARM in particular) soon. Bionic-side implementation here:
  https://android-review.googlesource.com/170988.
* Via a function call, as a fallback for platforms that provide
  neither a fixed TLS slot, nor a reasonable TLS implementation (i.e.
  not emutls).

This is a re-commit of a change in r248357 that was reverted in
r248358.

llvm-svn: 248405
2015-09-23 18:07:56 +00:00
Sanjay Patel b14ecd34f7 move call to convertIntLogicToFPLogic up; NFCI
The BEXTR comments didn't make sense before, we may want to extend the
FP logic transform to work on vectors, and this way is more beautiful.

llvm-svn: 248404
2015-09-23 18:03:37 +00:00
Adrian Prantl c040893085 Temporarily make testcase more verbose to debug a msvc buildbot failure.
llvm-svn: 248403
2015-09-23 17:59:45 +00:00
Chen Li 5cd6deeae3 [Bug 24848] Use range metadata to constant fold comparisons with constant values
Summary:
This is the first part of fixing bug 24848 https://llvm.org/bugs/show_bug.cgi?id=24848.

When range metadata is provided, it should be used to constant fold comparisons with constant values.

Reviewers: sanjoy, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 248402
2015-09-23 17:58:44 +00:00
Siva Chandra cebabb9fc0 DWARFASTParserClang::CompleteTypeFromDWARF: Handle incomplete baseclass or child
Summary:
With this change DWARFASTParserClang::CompleteTypeFromDWARF returns false if
DWARFASTParserClang::ParseChildMembers returns false. Similarly, it returns
false if any base class is of an incomplete type. This helps in cases like
these:

  class Foo
  {
  public:
    std::string str;
  };
  ...
  Foo f;

If a file with the above code is compiled with a modern clang but without
the -fno-limit-debug-info (or similar) option, then the DWARF has only
a forward declration for std::string. In which case, the type for
"class Foo" cannot be completed. If LLDB does not detect that a child
member has incomplete type, then it wrongly conveys to clang (the LLDB
compiler) that "class Foo" is complete, and consequently crashes due to
an assertion failure in clang when running commands like "p f" or
"frame var f".

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 248401
2015-09-23 17:47:08 +00:00
Artem Belevich 7b41f70e6c [CUDA] __global__ functions should always be visible externally.
Adjust __global__ functions with DiscardableODR linkage to use
StrongODR linkage instead, so they are visible externally.

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

llvm-svn: 248400
2015-09-23 17:44:53 +00:00
Sanjay Patel ade3abd2d9 [x86] move code for converting int logic to FP logic to a helper function; NFCI
This is a follow-on to:
http://reviews.llvm.org/rL248395

so we can add the call to the or/xor combines too.

llvm-svn: 248399
2015-09-23 17:39:41 +00:00
Adrian Prantl a112ef9e2d dsymutil: Resolve forward decls for types defined in clang modules.
This patch extends llvm-dsymutil's ODR type uniquing machinery to also
resolve forward decls for types defined in clang modules.

http://reviews.llvm.org/D13038

llvm-svn: 248398
2015-09-23 17:35:52 +00:00