Commit Graph

181683 Commits

Author SHA1 Message Date
Juergen Ributzka 77bc09f5ab [FastISel][AArch64] Don't fold instructions that are not in the same basic block.
This fix checks first if the instruction to be folded (e.g. sign-/zero-extend,
or shift) is in the same machine basic block as the instruction we are folding
into.

Not doing so can result in incorrect code, because the value might not be
live-out of the basic block, where the value is defined.

This fixes rdar://problem/18169495.

llvm-svn: 216700
2014-08-29 00:19:21 +00:00
Hans Wennborg 0a20f5417c Better codegen support for DLL attributes being dropped after the first declaration (PR20792)
For the following code:

  __declspec(dllimport) int f(int x);
  int user(int x) {
    return f(x);
  }
  int f(int x) { return 1; }

Clang will drop the dllimport attribute in the AST, but CodeGen would have
already put it on the LLVM::Function, and that would never get updated.
(The same thing happens for global variables.)

This makes Clang check dropped DLL attribute case each time the LLVM object
is referenced.

This isn't perfect, because we will still get it wrong if the function is
never referenced by codegen after the attribute is dropped, but this handles
the common cases and makes us not fail in the verifier.

llvm-svn: 216699
2014-08-29 00:16:06 +00:00
David Majnemer 400e725bde Revert two GEP-related InstCombine commits
This reverts commit r216523 and r216598; people have reported
regressions.

llvm-svn: 216698
2014-08-29 00:06:43 +00:00
Alexey Samsonov b4f99dd077 Don't create a null reference in ASTUnit::LoadFromCommandLine.
This change is the last in the pack of five commits
(also see r216691, r216694, r216695, and r216696) that reduces the number
of test failures in "check-clang" invocation in UBSan bootstrap
from 2443 down to 5.

llvm-svn: 216697
2014-08-28 23:51:01 +00:00
Alexey Samsonov 75bb28ec04 Don't load invalid enum value in Sema::LazilyCreateBuiltin.
This bug was reported by UBSan.

llvm-svn: 216696
2014-08-28 23:34:32 +00:00
Alexey Samsonov 1cf6af652f Don't load ill-formed AmbiguityKind in Sema::Lookup.
This bug was reported by UBSan.

llvm-svn: 216695
2014-08-28 23:17:55 +00:00
Alexey Samsonov 5afc294ba4 Properly align inline space for ImplicitConversionSequences in OverloadSet.
This bug was reported by UBSan.

llvm-svn: 216694
2014-08-28 22:59:39 +00:00
Reid Kleckner febb279c9c Don't promote byval pointer arguments when padding matters
Don't promote byval pointer arguments when when their size in bits is
not equal to their alloc size in bits. This can happen for x86_fp80,
where the size in bits is 80 but the alloca size in bits in 128.
Promoting these types can break passing unions of x86_fp80s and other
types.

Patch by Thomas Jablin!

Reviewed By: rnk

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

llvm-svn: 216693
2014-08-28 22:42:00 +00:00
Kostya Serebryany ac77055272 [asan] introduce __asan_load_cxx_array_cookie: check that the array cookie address is properly poisoned and return the cookie value. If not, return 0 to avoid infinite loop of DTORs (in case of use-after-free). Calls to this function will be inserted by clang (separate change)
llvm-svn: 216692
2014-08-28 22:28:04 +00:00
Alexey Samsonov d07864a37b Don't create a null reference to NestedNameSpecifier.
This bug was reported by UBSan.

llvm-svn: 216691
2014-08-28 22:18:42 +00:00
Todd Fiala 281961a821 Added setting: platform.plugin.linux.use-llgs-for-local (boolean), defaults to false
This setting is not yet hooked up to anything.  In preparation for
adding/testing llgs for local Linux debugging.

llvm-svn: 216690
2014-08-28 22:17:54 +00:00
Jim Grosbach ec2b0d0b11 AArch64: More correctly constrain target vector extend lowering.
The AArch64 target lowering for [zs]ext of vectors is set up to handle
input simple types and expects the generic SDag path to do something reasonable
with anything that's not a simple type. The code, however, was only
checking that the result type was a simple type and assuming that
implied that the source type would also be a simple type. That's not a
valid assumption, as operations like "zext <1 x i1> %0 to <1 x i32>"
demonstrate. The fix is to simply explicitly validate the source type
as well as the result type.

PR20791

llvm-svn: 216689
2014-08-28 22:08:28 +00:00
Sanjay Patel ccd267683b Move FNEG next to FABS and make them more similar, so it's easier that they can be refactored. NFC.
llvm-svn: 216688
2014-08-28 21:51:37 +00:00
Rafael Espindola ed1233e8a7 Call powerpc-darwin external tools with -arch ppc.
With this patch we call external tools for powerpc-darwin with "-arch ppc"
instead of "-arch powerpc", so as to be compatible with the cctools assembler
and ld64 linker.

Patch by Stephen Drake!

llvm-svn: 216687
2014-08-28 21:23:05 +00:00
Todd Fiala 0b903a0f69 Ensure the Host wait4 thread is able to show pid in thread name.
For hosts that cannot support long thread names, shrink the host
wait4 thread name so that it does not truncate the PID in the thread name.

Change by Shawn Best.

llvm-svn: 216686
2014-08-28 21:21:39 +00:00
Richard Smith 6a5ca27af5 Oops, use correct RUN: line for test.
llvm-svn: 216685
2014-08-28 21:09:23 +00:00
Kostya Serebryany 1e3b338606 [asan] disable poison_array_cookie while I am investigating a false positive on chromium (I suspect that LLVM looses nosanitizer metadata; no test yet)
llvm-svn: 216684
2014-08-28 20:24:05 +00:00
Richard Smith 13ad07aca3 [modules] PR20786: add (already passing) regression test from the bug report.
llvm-svn: 216683
2014-08-28 20:14:15 +00:00
Rafael Espindola b43d51de95 On MachO, don't put non-private constants in mergeable sections.
On MachO, putting a symbol that doesn't start with a 'L' or 'l' in one of the
__TEXT,__literal* sections prevents the linker from merging the context of the
section.

Since private GVs are the ones the get mangled to start with 'L' or 'l', we now
only put those on the __TEXT,__literal* sections.

llvm-svn: 216682
2014-08-28 20:13:31 +00:00
Frederic Riss 9e32475f18 Constify MCSymbol* parameters to DwarfDebug::attachLowHighPC.
llvm-svn: 216681
2014-08-28 19:09:29 +00:00
Rui Ueyama 4a6ead7a9f [PECOFF] Another Win64 relocation bug fix
When a relocation is applied to a location, the new value needs
to be added to the existing value at the location. Existing
value is in most cases zero, but if not, the current code does
not work.

llvm-svn: 216680
2014-08-28 19:00:40 +00:00
Sanjay Patel 81ecbb0737 Fix a logic bug in x86 vector codegen: sext (zext (x) ) != sext (x) (PR20472).
Remove a block of code from LowerSIGN_EXTEND_INREG() that was added with:
http://llvm.org/viewvc/llvm-project?view=revision&revision=177421

And caused:
http://llvm.org/bugs/show_bug.cgi?id=20472 (more analysis here)
http://llvm.org/bugs/show_bug.cgi?id=18054

The testcases confirm that we (1) don't remove a zext op that is necessary and (2) generate
a pmovz instead of punpck if SSE4.1 is available. Although pmovz is 1 byte longer, it allows 
folding of the load, and so saves 3 bytes overall.

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

llvm-svn: 216679
2014-08-28 18:59:22 +00:00
Owen Anderson 3eb910b404 Do not introduce new shuffle patterns after operation legalization if SHUFFLE_VECTOR
was marked custom.  The target independent DAG combine has no way to know if
the shuffles it is introducing are ones that the target could support or not.

llvm-svn: 216678
2014-08-28 17:49:58 +00:00
Aaron Ballman 455f42c9e8 Reverting r216675. This breaks some bots. Before this can be committed again, I have to explore runtime ABI requirements with libc++abi.
llvm-svn: 216677
2014-08-28 17:24:14 +00:00
Fariborz Jahanian 85b99da72a Objective-C IRGen. Fixes an assertion crash caused by inconsistent
linkage related to generation of OBJC_SELECTOR_REFERENCES symbol 
needed in generation of call to 'super' in a class method.
// rdar://18150301

llvm-svn: 216676
2014-08-28 17:05:17 +00:00
Aaron Ballman 33375375a4 Throw a std::bad_array_new_length exception when the expression (or constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644.
llvm-svn: 216675
2014-08-28 16:48:44 +00:00
Sanjay Patel 50cbfc5138 Janitorial services: "Don’t duplicate function or class name at the beginning of the comment."
llvm-svn: 216674
2014-08-28 16:29:51 +00:00
Sanjay Patel e28d57d9d8 Remove local TLI vars that are just duplicates of the class var. No functional change.
llvm-svn: 216673
2014-08-28 16:01:50 +00:00
Sanjay Patel 78614bf0e8 Use local vars to improve readability. No functional change.
Completes what was started in r216611 and r216623. 
Used const refs instead of pointers; not sure if one is preferable to the other.

llvm-svn: 216672
2014-08-28 15:53:16 +00:00
Samuel Benzaquen e2c034c124 Cache the memoization data for DynTypedNodes.
Summary:
Cache the memoization data for DynTypedNodes.
It is free to do so on create(), but expensive to determine dynamically.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 216671
2014-08-28 15:49:06 +00:00
Todd Fiala a9882cee50 llgs: add proper exec support for Linux.
This change:
* properly captures execs in NativeProcessLinux.
* clears out all non-main-thread thread metadata in NativeProcessLinux on exec.
* adds a DidExec() method to the NativeProcessProtocol delegate.
* clears out the auxv data cache when we exec (on Linux).

This is a small part of the llgs for local Linux debugging work going on here:
https://github.com/tfiala/lldb/tree/dev-llgs-local

I'm breaking it into small patches.

llvm-svn: 216670
2014-08-28 15:46:54 +00:00
Yi Kong a8833f0c28 arm_acle: Fix error in ROR implementation
The logic in calculating the rotate amount was flawed.

Thanks Pasi Parviainen for pointing out!

llvm-svn: 216669
2014-08-28 15:25:52 +00:00
Todd Fiala 02e7181508 lldb - towards AArch64 being recognised as platform architecture
See http://reviews.llvm.org/D4381.

Change by Paul Osmialowski.

llvm-svn: 216668
2014-08-28 14:32:43 +00:00
Sid Manning 67a8936a84 Minor spelling correction.
Reviewers: adasgupt, jverma, sidneym

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

llvm-svn: 216667
2014-08-28 14:16:32 +00:00
Aaron Ballman a4aa0d7cc0 Silence a -Wsign-compare warning. NFC.
llvm-svn: 216666
2014-08-28 13:23:26 +00:00
Timur Iskhodzhanov f77d20b1a9 [ASan/Win] Add a test case for r216663 [-Zl vs LIBCMT vs asan_win_uar_thunk]
llvm-svn: 216665
2014-08-28 13:20:23 +00:00
NAKAMURA Takumi 37011a1e24 [CMake] clangStaticAnalyzerFrontend: Add clangLex, corresponding to r216550.
llvm-svn: 216664
2014-08-28 12:42:28 +00:00
Timur Iskhodzhanov 737370da20 [ASan/Win] Add the -Zl flag to avoid /DEFAULTLIB:libcmt directive in the asan_win_uar_thunk object file
This directive results in 'symbol already defined' when linking DLLs that use -MD

llvm-svn: 216663
2014-08-28 12:28:04 +00:00
Oliver Stannard 28ee5d2e90 [ARM] Change default ABI for AArch32 to be "aapcs" (was "apcs-gnu")
The current default abi when no environment is given is "apcs-gnu",
which is obsolete. This patch changes the default to "aapcs". "aapcs" has both
hard- and soft-float variants, so the -mhard-float, -msoft-float and
-mfloat-abi= options now all behave as expected when no environment is
specified in the triple.

While writing this I also noticed that a preprocessor test claims to be
checking darwin, but is actually checking the defaults, which are
different for darwin.

llvm-svn: 216662
2014-08-28 12:15:49 +00:00
Alexander Potapenko 2164fa3b9b [ubsan] Follow-up for r216657: fixed the line numbers in the test.
llvm-svn: 216661
2014-08-28 10:25:17 +00:00
Arnaud A. de Grandmaison efd4363172 [PBQP] Only output debug information when requested
llvm-svn: 216660
2014-08-28 10:15:47 +00:00
David Majnemer 074052b623 InstCombine: Remove redundant combines
InstSimplify already handles icmp (X+Y), X (and things like it)
appropriately.  The first thing that InstCombine does is run
InstSimplify on the instruction.

llvm-svn: 216659
2014-08-28 10:08:37 +00:00
Yi Kong 623393f31e arm_acle: Implement data processing intrinsics
Summary:
ACLE 2.0 section 9.2 defines the following "miscellaneous data processing intrinsics": `__clz`, `__cls`, `__ror`, `__rev`, `__rev16`, `__revsh` and `__rbit`.

`__clz` has already been implemented in the arm_acle.h header file. The rest are not supported yet. This patch completes ACLE data processing intrinsics.

Reviewers: t.p.northover, rengolin

Reviewed By: rengolin

Subscribers: aemerson, mroth, llvm-commits

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

llvm-svn: 216658
2014-08-28 09:44:07 +00:00
Alexander Potapenko 53cce89a81 [UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin
to make the tests green.
Slow stack unwinding is disabled in libsanitizer on Darwin now.

llvm-svn: 216657
2014-08-28 09:25:06 +00:00
Erik Eckstein 8354cfaf95 Fix: SLPVectorizer tried to move an instruction which was replaced by a vector instruction.
For a detailed description of the problem see the comment in the test file.
The problematic moveBefore() calls are not required anymore because the new
scheduling algorithm ensures a correct ordering anyway.

llvm-svn: 216656
2014-08-28 07:04:02 +00:00
Alexey Bataev 16d08fe521 Fixed test compatibility with MSVC codegen.
llvm-svn: 216655
2014-08-28 06:37:56 +00:00
Michel Danzer 7b77ab7b2c Fix build against LLVM SVN >= r216488
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 216654
2014-08-28 06:19:37 +00:00
Michel Danzer a10b492ce3 Fix build against LLVM SVN >= r216393
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 216653
2014-08-28 06:19:33 +00:00
Richard Smith 01bdb7a971 [modules] When completing the redecl chain for an anonymous declaration in a
merged context, pull in the lexical decls in that context, since one of them
may complete the redecl chain.

llvm-svn: 216652
2014-08-28 05:44:07 +00:00
David Xu ee978203e6 Generate CMN when comparing a short int with minus
llvm-svn: 216651
2014-08-28 04:59:53 +00:00