Commit Graph

186515 Commits

Author SHA1 Message Date
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Fariborz Jahanian 902edb9a2b Remove this test too.
llvm-svn: 221715
2014-11-11 21:54:53 +00:00
Fariborz Jahanian 3365bfc609 Revert r221702 until I address Richard Trieu's
comments.

llvm-svn: 221714
2014-11-11 21:54:19 +00:00
Alexey Samsonov cfc9d3fe17 Simplify the test by using multiple --check-prefix arguments
llvm-svn: 221713
2014-11-11 21:50:44 +00:00
Duncan P. N. Exon Smith 2b1f278e77 Revert "IR: MDNode => Value: Update for LLVM API change in r221375"
This reverts commit r221376.

The API change was reverted in r221711.

llvm-svn: 221712
2014-11-11 21:31:03 +00:00
Duncan P. N. Exon Smith de36e8040f Revert "IR: MDNode => Value"
Instead, we're going to separate metadata from the Value hierarchy.  See
PR21532.

This reverts commit r221375.
This reverts commit r221373.
This reverts commit r221359.
This reverts commit r221167.
This reverts commit r221027.
This reverts commit r221024.
This reverts commit r221023.
This reverts commit r220995.
This reverts commit r220994.

llvm-svn: 221711
2014-11-11 21:30:22 +00:00
Tom Roeder 6312f4a422 Fix build break: remove unused variable in FCFI.
llvm-svn: 221710
2014-11-11 21:26:33 +00:00
Frederic Riss 8ad4f498fb Totally forget deallocated SDNodes in SDDbgInfo.
What would happen before that commit is that the SDDbgValues associated with
a deallocated SDNode would be marked Invalidated, but SDDbgInfo would keep
a map entry keyed by the SDNode pointer pointing to this list of invalidated
SDDbgNodes. As the memory gets reused, the list might get wrongly associated
with another new SDNode. As the SDDbgValues are cloned when they are transfered,
this can lead to an exponential number of SDDbgValues being produced during
DAGCombine like in http://llvm.org/bugs/show_bug.cgi?id=20893

Note that the previous behavior wasn't really buggy as the invalidation made
sure that the SDDbgValues won't be used. This commit can be considered a
memory optimization and as such is really hard to validate in a unit-test.

llvm-svn: 221709
2014-11-11 21:21:08 +00:00
Tom Roeder eb7a303d1b Add Forward Control-Flow Integrity.
This commit adds a new pass that can inject checks before indirect calls to
make sure that these calls target known locations. It supports three types of
checks and, at compile time, it can take the name of a custom function to call
when an indirect call check fails. The default failure function ignores the
error and continues.

This pass incidentally moves the function JumpInstrTables::transformType from
private to public and makes it static (with a new argument that specifies the
table type to use); this is so that the CFI code can transform function types
at call sites to determine which jump-instruction table to use for the check at
that site.

Also, this removes support for jumptables in ARM, pending further performance
analysis and discussion.

Review: http://reviews.llvm.org/D4167
llvm-svn: 221708
2014-11-11 21:08:02 +00:00
Colin LeMahieu eb4675fb29 [llvm-mc] Fixing case where if a file ended with non-newline whitespace or a comma it would access invalid memory.
Cleaned up parse loop.

llvm-svn: 221707
2014-11-11 21:03:09 +00:00
Sanjay Patel e2e589288f Use rcpss/rcpps (X86) to speed up reciprocal calcs (PR21385).
This is a first step for generating SSE rcp instructions for reciprocal
calcs when fast-math allows it. This is very similar to the rsqrt optimization
enabled in D5658 ( http://reviews.llvm.org/rL220570 ).

For now, be conservative and only enable this for AMD btver2 where performance
improves significantly both in terms of latency and throughput.

We may never enable this codegen for Intel Core* chips because the divider circuits
are just too fast. On SandyBridge, divss can be as fast as 10 cycles versus the 21
cycle critical path for the rcp + mul + sub + mul + add estimate.

Follow-on patches may allow configuration of the number of Newton-Raphson refinement
steps, add AVX512 support, and enable the optimization for more chips.

More background here: http://llvm.org/bugs/show_bug.cgi?id=21385

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

llvm-svn: 221706
2014-11-11 20:51:00 +00:00
Rafael Espindola 07e694d293 Simplify testcase. NFC.
Thanks to Filipe Cabecinhas for the tip.

llvm-svn: 221705
2014-11-11 20:49:16 +00:00
David Blaikie 42edade9d9 PR16091 continued: Debug Info for member functions with undeduced return types.
So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704
2014-11-11 20:44:45 +00:00
Bill Schmidt 3d9674cfb1 [PowerPC] Replace foul hackery with real calls to __tls_get_addr
My original support for the general dynamic and local dynamic TLS
models contained some fairly obtuse hacks to generate calls to
__tls_get_addr when lowering a TargetGlobalAddress.  Rather than
generating real calls, special GET_TLS_ADDR nodes were used to wrap
the calls and only reveal them at assembly time.  I attempted to
provide correct parameter and return values by chaining CopyToReg and
CopyFromReg nodes onto the GET_TLS_ADDR nodes, but this was also not
fully correct.  Problems were seen with two back-to-back stores to TLS
variables, where the call sequences ended up overlapping with unhappy
results.  Additionally, since these weren't real calls, the proper
register side effects of a call were not recorded, so clobbered values
were kept live across the calls.

The proper thing to do is to lower these into calls in the first
place.  This is relatively straightforward; see the changes to
PPCTargetLowering::LowerGlobalTLSAddress() in PPCISelLowering.cpp.
The changes here are standard call lowering, except that we need to
track the fact that these calls will require a relocation.  This is
done by adding a machine operand flag of MO_TLSLD or MO_TLSGD to the
TargetGlobalAddress operand that appears earlier in the sequence.

The calls to LowerCallTo() eventually find their way to
LowerCall_64SVR4() or LowerCall_32SVR4(), which call FinishCall(),
which calls PrepareCall().  In PrepareCall(), we detect the calls to
__tls_get_addr and immediately snag the TargetGlobalTLSAddress with
the annotated relocation information.  This becomes an extra operand
on the call following the callee, which is expected for nodes of type
tlscall.  We change the call opcode to CALL_TLS for this case.  Back
in FinishCall(), we change it again to CALL_NOP_TLS for 64-bit only,
since we require a TOC-restore nop following the call for the 64-bit
ABIs.

During selection, patterns in PPCInstrInfo.td and PPCInstr64Bit.td
convert the CALL_TLS nodes into BL_TLS nodes, and convert the
CALL_NOP_TLS nodes into BL8_NOP_TLS nodes.  This replaces the code
removed from PPCAsmPrinter.cpp, as the BL_TLS or BL8_NOP_TLS
nodes can now be emitted normally using their patterns and the
associated printTLSCall print method.

Finally, as a result of these changes, all references to get-tls-addr
in its various guises are no longer used, so they have been removed.

There are existing TLS tests to verify the changes haven't messed
anything up).  I've added one new test that verifies that the problem
with the original code has been fixed.

llvm-svn: 221703
2014-11-11 20:44:09 +00:00
Fariborz Jahanian c5fd4844da Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702
2014-11-11 19:59:16 +00:00
Enrico Granata 944547deab Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906
llvm-svn: 221701
2014-11-11 19:52:12 +00:00
Rafael Espindola a9c28b68cd Use a 8 bit immediate when possible.
This fixes pr21529.

llvm-svn: 221700
2014-11-11 19:46:36 +00:00
Daniel Jasper 64a328e96f clang-format: Preserve trailing-comma logic even with comments.
Before:
  vector<int> SomeVector = {// aaa
                            1, 2,
  };

After:
  vector<int> SomeVector = {
      // aaa
      1, 2,
  };

llvm-svn: 221699
2014-11-11 19:34:57 +00:00
Richard Smith 57e18ac96d First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698
2014-11-11 19:30:41 +00:00
Marshall Clow 981f31ac51 Fix typo in allocator_traits::construct. This fixes PR14175, which shows up if an allocator has a no-args construct method
llvm-svn: 221697
2014-11-11 19:22:33 +00:00
Kevin Enderby 3eb73e1d39 Fix a warning about ‘r_type’ may be used uninitialized.
Thanks to Aaron Ballman for noticing this!

llvm-svn: 221696
2014-11-11 19:16:45 +00:00
Dario Domizioli e904e85faf [X86][ELF] Fix PR20243 - leaf frame pointer bug with TLS access
The ISel lowering for global TLS access in PIC mode was creating a pseudo 
instruction that is later expanded to a call, but the code was not 
setting the hasCalls flag in the MachineFrameInfo alongside the adjustsStack 
flag. This caused some functions to be mistakenly recognized as leaf functions,
and this in turn affected the decision to eliminate the frame pointer.

With the fix, hasCalls is properly set and the leaf frame pointer is correctly
preserved.

llvm-svn: 221695
2014-11-11 18:44:49 +00:00
Shawn Best 590e943a81 Add -std=c99 for building the test case of TestValueVarUpdate - for Siva Chandra : http://reviews.llvm.org/D6201
llvm-svn: 221694
2014-11-11 17:45:00 +00:00
Oliver Stannard 8c2c67e63c LLVM incorrectly folds xor into select
LLVM replaces the SelectionDAG pattern (xor (set_cc cc x y) 1) with
(set_cc !cc x y), which is only correct when the xor has type i1.
Instead, we should check that the constant operand to the xor is all
ones.

llvm-svn: 221693
2014-11-11 17:36:01 +00:00
Shawn Best 1ecb68d5ce Substitute cc with c++ when compiling c++ test files for Siva Chandra : http://reviews.llvm.org/D6199
llvm-svn: 221692
2014-11-11 17:34:58 +00:00
Fariborz Jahanian a29986c0b0 This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691
2014-11-11 16:56:21 +00:00
Marshall Clow f1ce9c177f Fixed a typo in a paper name: 4190 --> N4190
llvm-svn: 221690
2014-11-11 16:45:50 +00:00
Marshall Clow 862af58793 Added vector<T>::insert tests suggested by code coverage results
llvm-svn: 221689
2014-11-11 16:44:05 +00:00
Manuel Klimek 6dffa35ddd DiagnosticParseKinds is close to running into DiagnosticASTKinds.
$ grep "def " include/clang/Basic/DiagnosticParseKinds.td |wc -l
396

llvm-svn: 221688
2014-11-11 15:45:49 +00:00
Jay Foad cf2d4b8ea4 [ASan] Fix use of -asan-instrument-assembly in tests
Summary:
The option -asan-instrument-assembly is declared in the X86 backend.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=All then the
option is tolerated but ignored.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=PowerPC then
the testsuite fails with:
[ 93%] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64-inline.o
clang (LLVM option parsing): Unknown command line argument '-asan-instrument-assembly'.  Try: 'clang (LLVM option parsing) -help'

Fix this inconsistency by only adding the option if that toolchain was
built with the X86 backend included.

Reviewers: kcc, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 221687
2014-11-11 13:44:08 +00:00
Vasileios Kalintiris b2dd15f8c7 [mips] Add preliminary support for the MIPS II target.
Summary:
This patch enables code generation for the MIPS II target. Pre-Mips32
targets don't have the MUL instruction, so we add the correspondent
pattern that uses the MULT/MFLO combination in order to retrieve the
product.

This is WIP as we don't support code generation for select nodes due to
the lack of conditional-move instructions.

Reviewers: dsanders

Subscribers: llvm-commits

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

llvm-svn: 221686
2014-11-11 11:43:55 +00:00
Vasileios Kalintiris 8c1c95e95c [mips] Add hardware register name "hwr_ulr" ($29)
The canonical name when printing assembly is still $29. The reason is that
GAS does not accept "$hwr_ulr" at the moment.

This addresses the comments from r221307, which reverted the original
commit r221299.

llvm-svn: 221685
2014-11-11 11:22:39 +00:00
Andrea Di Biagio 5fa2e15453 [X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.
This helps the DAGCombiner to identify more opportunities to fold shuffles.

llvm-svn: 221684
2014-11-11 11:20:31 +00:00
Jason Molenda d20359d810 Add support for 32-bit core file dumping. Add support for i386 process core file dumping.
llvm-svn: 221683
2014-11-11 10:59:15 +00:00
Jason Molenda 466ffa5676 Put the current pc arrow back into the default disassembly format.
I went back and forth on removing this - and tried dropping it for
a few weeks.  But when you're working at an assembly language, it
really is helpful to have this displayed to show where the current
pc is.

llvm-svn: 221682
2014-11-11 10:32:04 +00:00
Vasileios Kalintiris 10b5ba3f6e Recommit "[mips] Add names and tests for the hardware registers"
The original commit r221299 was reverted in r221307.  I removed the name
"hrw_ulr" ($29) from the original commit because two tests were failing.

llvm-svn: 221681
2014-11-11 10:31:31 +00:00
David Majnemer 185b5b1d24 llvm-objdump: Skip empty sections when dumping contents
Empty sections are just noise when using objdump.
This is similar to what binutils does.

llvm-svn: 221680
2014-11-11 09:58:25 +00:00
Manuel Klimek bfd0039e73 Was convinced in commit comments that requiring a specific python version is the wrong approach; reverting.
llvm-svn: 221679
2014-11-11 08:53:18 +00:00
David Majnemer 2cc4bc77bf MC, COFF: Use relocations for function references inside the section
Referencing one symbol from another in the same section does not
generally require a relocation.  However, the MS linker has a feature
called /INCREMENTAL which enables incremental links.  It achieves this
by creating thunks to the actual function and redirecting all
relocations to point to the thunk.

This breaks down with the old scheme if you have a function which
references, say, itself.  On x86_64, we would use %rip relative
addressing to reference the start of the function from out current
position.  This would lead to miscompiles because other references might
reference the thunk instead, breaking function pointer equality.

This fixes PR21520.

llvm-svn: 221678
2014-11-11 08:43:57 +00:00
Jason Molenda d158db0f63 Add an operator== to the RegisterNumber class; it simplifies
RegisterContextLLDB a bit more in a few places.

llvm-svn: 221677
2014-11-11 08:26:44 +00:00
NAKAMURA Takumi cdcbfba3b6 CGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]
llvm-svn: 221676
2014-11-11 07:58:06 +00:00
NAKAMURA Takumi 51078115c0 [CMake] llvm-shlib: Prune redundant components, AsmPrinter, MC, and SelectionDAG.
llvm-svn: 221675
2014-11-11 07:57:25 +00:00
Suyog Sarda beb064bd94 Addition to r216371 (SLP and Loop Vectorization) and r218607 where
cost model for signed division by power of 2 was improved for AArch64.
The revision r218607 missed test case for Loop Vectorization.
Adding it in this revision.

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

llvm-svn: 221674
2014-11-11 07:39:27 +00:00
Craig Topper f655cddb13 Use uint64_t as the type for the X86 TSFlag format enum. Allows removal of the VEXShift hack that was used to access the higher bits of TSFlags.
llvm-svn: 221673
2014-11-11 07:32:32 +00:00
Michael Kuperstein 3fe15e498f [X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext
This fixes an issue with matching trunc -> assertsext -> zext on x86-64, which would not zero the high 32-bits. See PR20494 for details.
Recommitting - This time, with a hopefully working test.

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

llvm-svn: 221672
2014-11-11 07:07:40 +00:00
Rafael Espindola f7b5ba0621 Only run the gold plugin tests if gold supports the targets we test with.
This fixes pr21345.

llvm-svn: 221669
2014-11-11 05:27:12 +00:00
Jingyue Wu dfd4eb9285 [NVPTX] Remove dead code in NVPTXTargetTransformInfo (NFC)
llvm-svn: 221668
2014-11-11 05:24:04 +00:00
Rafael Espindola 961d469445 MCAsmParserExtension has a copy of the MCAsmParser. Use it.
Base classes were storing a second copy.

llvm-svn: 221667
2014-11-11 05:18:41 +00:00
Rafael Espindola 804f43c655 Add const. NFC.
This adds const to a few methods that already return const references or
creates a const version when they reterun non-const references.

llvm-svn: 221666
2014-11-11 05:11:47 +00:00
Rafael Espindola 2d5cbc9569 Don't duplicate names in comments. NFC.
llvm-svn: 221665
2014-11-11 04:58:32 +00:00