Jay Foad [Thu, 25 Jun 2015 06:22:31 +0000 (06:22 +0000)]
Enable memory sanitizer for PPC64
Summary:
This patch adds basic memory sanitizer support for PPC64. PR23219.
I have further patches ready to enable it in LLVM and Clang, and to fix
most of the many failing tests in check-msan.
Reviewers: kcc, willschm, samsonov, wschmidt, eugenis
Reviewed By: eugenis
Subscribers: wschmidt, llvm-commits
Differential Revision: http://reviews.llvm.org/D10648
llvm-svn: 240623
Rui Ueyama [Thu, 25 Jun 2015 03:31:47 +0000 (03:31 +0000)]
COFF: Fix a bug of __imp_ symbol.
The change I made in r240620 was not correct. If a symbol foo is
defined, and if you use __imp_foo, __imp_foo symbol is automatically
defined as a pointer (not just an alias) to foo.
Now that we need to create a chunk for automatically-created symbols.
I defined LocalImportChunk class for them.
llvm-svn: 240622
Jason Molenda [Thu, 25 Jun 2015 03:03:47 +0000 (03:03 +0000)]
xcode project file updates for the movement of the POSIX files into the FreeBSD process subdir.
llvm-svn: 240621
Rui Ueyama [Thu, 25 Jun 2015 02:21:44 +0000 (02:21 +0000)]
COFF: Handle undefined symbols starting with __imp_ in a special way.
MSVC linker is able to link an object file created from the following code.
Note that __imp_hello is not defined anywhere.
void hello() { printf("Hello\n"); }
extern void (*__imp_hello)();
int main() { __imp_hello(); }
Function symbols exported from DLLs are automatically mangled by appending
__imp_ prefix, so they have two names (original one and with the prefix).
This "feature" seems to simulate that behavior even for non-DLL symbols.
This is in my opnion very odd feature. Even MSVC linker warns if you use this.
I'm adding that anyway for the sake of compatibiltiy.
llvm-svn: 240620
Steven Wu [Thu, 25 Jun 2015 01:59:35 +0000 (01:59 +0000)]
Update darwin SDK version parsing to support OSX and simulator
This re-commits r226005 with a tweak. The origin attempt failed because
Darwin bot sets up SDKROOT and clang can deduce SDK version from them
after this patch. That broke many driver tests due to the change of
deployment target version. Now the tests should not complain after
r240574.
llvm-svn: 240619
Alexey Samsonov [Thu, 25 Jun 2015 00:58:02 +0000 (00:58 +0000)]
[UBSan] Allow to use -fsanitize=vptr only on Mac OS 10.9+
See https://llvm.org/bugs/show_bug.cgi?id=23539 for why this
is necessary.
llvm-svn: 240618
Alexey Samsonov [Thu, 25 Jun 2015 00:57:42 +0000 (00:57 +0000)]
[CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.
Summary:
This patch implements step 1 from
https://llvm.org/bugs/show_bug.cgi?id=23539#c10
I'd appreciate if you could test it on Mac OS and verify that parts of UBSan
runtime that reference C++ ABI symbols are properly excluded, and fix ASan/UBSan
builds.
Test Plan: regression test suite
Reviewers: thakis, hans
Subscribers: llvm-commits, zaks.anna, kubabrecka
Differential Revision: http://reviews.llvm.org/D10621
llvm-svn: 240617
Ahmed Bougacha [Thu, 25 Jun 2015 00:44:46 +0000 (00:44 +0000)]
[X86] Accept hasAVX512() as well as hasFMA() when generating FMA.
We don't always have FMA, for example when using 'clang -mavx512f'
without an explicit CPU.
Also check for an explicit +avx512f instead of CPUs in a couple
related tests.
llvm-svn: 240616
Ahmed Bougacha [Thu, 25 Jun 2015 00:40:25 +0000 (00:40 +0000)]
[X86] Cleanup fma tests a little bit. NFC.
Reformat, isolate 213->231 xform, actually --check-prefix CHECK,
and deduplicate the FMA intrinsic tests (FMA3 in AMD-land).
llvm-svn: 240615
Rui Ueyama [Thu, 25 Jun 2015 00:33:38 +0000 (00:33 +0000)]
COFF: Use COFFObjectFile::getRelocations(). NFC.
llvm-svn: 240614
Swaroop Sridhar [Thu, 25 Jun 2015 00:28:42 +0000 (00:28 +0000)]
Enable StackMap Serialization for COFF
Summary
This change turns on the emission of
__LLVM_Stackmaps section when generating COFF binaries.
Test Plan
Added a scenario to the test case:
test\CodeGen\X86\statepoint-stackmap-format.ll.
Code Review:
http://reviews.llvm.org/D10680
llvm-svn: 240613
Hubert Tong [Thu, 25 Jun 2015 00:25:49 +0000 (00:25 +0000)]
Consolidate and unify initializer list deduction
Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. This
extends the fix for PR12119 to also apply to the case where the
corresponding parameter is a trailing parameter pack.
Test Plan:
A test for deduction from nested initializer lists where the
corresponding parameter is a trailing parameter pack is added in
`clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp`.
Reviewers: fraggamuffin, rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D10681
llvm-svn: 240612
Hubert Tong [Thu, 25 Jun 2015 00:23:39 +0000 (00:23 +0000)]
[Concepts] Parsing of requires-clause in template-declaration
Summary:
This change implements parse-only acceptance of the optional
requires-clause in a template-declaration. Diagnostic testing is added
for cases where the grammar is ambiguous with the expectation that the
longest token sequence which matches the syntax of a
constraint-expression is consumed without backtracking.
Reviewers: faisalv, fraggamuffin, rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D10462
llvm-svn: 240611
Rui Ueyama [Thu, 25 Jun 2015 00:07:39 +0000 (00:07 +0000)]
libObject/COFF: Add a function to get pointers to relocation entries.
llvm-svn: 240610
Logan Chien [Thu, 25 Jun 2015 00:05:24 +0000 (00:05 +0000)]
Avoid C99 for-declaration statement in C files. (NFC)
To compile libunwind with gcc/g++ 4.9, it is required to avoid the
for-declaration statement from C99.
llvm-svn: 240609
Ranjeet Singh [Wed, 24 Jun 2015 23:39:25 +0000 (23:39 +0000)]
[ARM] The bits set in the variable HW_FP could get unset
when iterating through the Features vector if we don't
keep track of what's already been set. This could lead to
the macro __ARM_FP getting the wrong value. This patch
fixes this issue by keeping track of the bits that have
already been set in the loop.
Differential Revision: http://reviews.llvm.org/D10395
llvm-svn: 240607
Enrico Granata [Wed, 24 Jun 2015 23:13:23 +0000 (23:13 +0000)]
Handle (or at least don't crash) trying to get the encoding for a bunch of new builtin types in clang trunk
llvm-svn: 240606
Rui Ueyama [Wed, 24 Jun 2015 23:03:17 +0000 (23:03 +0000)]
COFF: Cache raw pointers to relocation tables.
Getting an iterator to the relocation table is very hot operation
in the linker. We do that not only to apply relocations but also
to mark live sections and to do ICF.
libObject's interface is slow. By caching pointers to the first
relocation table entries makes the linker 6% faster to self-link.
We probably need to fix libObject as well.
llvm-svn: 240603
Derek Schuff [Wed, 24 Jun 2015 22:36:38 +0000 (22:36 +0000)]
update comment
llvm-svn: 240601
Derek Schuff [Wed, 24 Jun 2015 22:36:36 +0000 (22:36 +0000)]
Relax assertion in x86_64 byval argument handling for 32-bit pointers
Summary:
Byval argument pair formation assumes that if a type is less than 8 bytes
it must be an integer and not a pointer, which is not true for x32 and NaCl.
Relax the assertion and add a test for a codegen case that triggered it.
Reviewers: jvoung
Subscribers: jfb, cfe-commits
Differential Revision: http://reviews.llvm.org/D10701
llvm-svn: 240600
Duncan P. N. Exon Smith [Wed, 24 Jun 2015 22:23:21 +0000 (22:23 +0000)]
Add simplify_type<const WeakVH>; simplify IndVarSimplify
r240214 fixed some UB in IndVarSimplify, and it needed a temporary
`WeakVH` to do it. Add `simplify_type<const WeakVH>` so that this
temporary isn't necessary.
llvm-svn: 240599
Douglas Katzman [Wed, 24 Jun 2015 22:04:55 +0000 (22:04 +0000)]
[X86] Simplify some stuff in X86DisassemblerDecoder. NFC
- Deciding that insn->sibIndex is SIB_INDEX_NONE does not require another
check beyond the fully decoded bits being equal to 0x4.
The expression insn->sibIndex == SIB_INDEX_sib could not have been true unless
index were 0x4, because SIB_INDEX_sib is merely the range base (SIB_INDEX_EAX)
plus 4. Respectively SIB_INDEX_sib64.
- Don't use a switch statement to perform left-shift.
Differential Revision: http://reviews.llvm.org/D9762
llvm-svn: 240598
Douglas Gregor [Wed, 24 Jun 2015 22:02:16 +0000 (22:02 +0000)]
Add __nonnull/__nullable/__null_unspecified predefines for Darwin.
Addresses the rest of rdar://problem/
21530726.
llvm-svn: 240597
Douglas Gregor [Wed, 24 Jun 2015 22:02:08 +0000 (22:02 +0000)]
Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:
__nonnull -> _Nonnull
__nullable -> _Nullable
__null_unspecified -> _Null_unspecified
This is the major part of rdar://problem/
21530726, but does not yet
provide the Darwin-specific behavior for the old names.
llvm-svn: 240596
David Majnemer [Wed, 24 Jun 2015 21:52:25 +0000 (21:52 +0000)]
[GVN] Intersect the IR flags when CSE'ing two instructions
We performed a simple, but incomplete, intersection when it came time to
CSE instructions. It didn't handle, for example, the 'exact' flag.
This fixes PR23922.
llvm-svn: 240595
Douglas Katzman [Wed, 24 Jun 2015 21:46:53 +0000 (21:46 +0000)]
Spelling fixes in comments.
llvm-svn: 240594
David Majnemer [Wed, 24 Jun 2015 21:27:36 +0000 (21:27 +0000)]
[Reassociate] Don't propogate flags when creating negations
Reassociate mutated existing instructions in order to form negations
which would create additional reassociate opportunities.
This fixes PR23926.
llvm-svn: 240593
Sanjay Patel [Wed, 24 Jun 2015 20:42:33 +0000 (20:42 +0000)]
fix typos; NFC
llvm-svn: 240592
Sanjay Patel [Wed, 24 Jun 2015 20:40:57 +0000 (20:40 +0000)]
don't repeat function names in comments; NFC
llvm-svn: 240591
Rui Ueyama [Wed, 24 Jun 2015 20:40:03 +0000 (20:40 +0000)]
COFF: Move code for ICF from Writer.cpp to ICF.cpp.
llvm-svn: 240590
Akira Hatanaka [Wed, 24 Jun 2015 20:34:35 +0000 (20:34 +0000)]
[If Converter] Convert recursion to iteration.
This commit makes changes to IfConverter::AnalyzeBlock to use iteration instead
of recursion. Previously, this function would get called recursively a large
number of times and eventually segfault when a function with the following CFG
was compiled:
BB0:
if (condition0)
goto BB1
goto BB2
BB1:
goto BB2
BB2:
if (condition1)
goto BB3
goto BB4
BB3:
...
(repeat until BB7488)
rdar://problem/
21386145
Differential Revision: http://reviews.llvm.org/D10587
llvm-svn: 240589
Pete Cooper [Wed, 24 Jun 2015 20:22:23 +0000 (20:22 +0000)]
Devirtualize Instruction::clone_impl
llvm-svn: 240588
Jingyue Wu [Wed, 24 Jun 2015 20:20:16 +0000 (20:20 +0000)]
Add NVPTXPeephole pass to reduce unnecessary address cast
Summary:
This patch first change the register that holds local address for stack
frame to %SPL. Then the new NVPTXPeephole pass will try to scan the
following pattern
%vreg0<def> = LEA_ADDRi64 <fi#0>, 4
%vreg1<def> = cvta_to_local %vreg0
and transform it into
%vreg1<def> = LEA_ADDRi64 %VRFrameLocal, 4
Patched by Xuetian Weng
Test Plan: test/CodeGen/NVPTX/local-stack-frame.ll
Reviewers: jholewinski, jingyue
Reviewed By: jingyue
Subscribers: eliben, jholewinski, llvm-commits
Differential Revision: http://reviews.llvm.org/D10549
llvm-svn: 240587
Chris Bieneman [Wed, 24 Jun 2015 20:13:44 +0000 (20:13 +0000)]
One more change required to build the sanitizers for iOS.
Summary: _Unwind_Backtrace is not available on iOS, so we should ifdef out the posix implementations of BufferedStackTrace::SlowUnwindStack and BufferedStackTrace::SlowUnwindStackWithContext on iOS.
Reviewers: samsonov
Reviewed By: samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10696
llvm-svn: 240586
Sanjay Patel [Wed, 24 Jun 2015 20:07:50 +0000 (20:07 +0000)]
fix typos; NFC
llvm-svn: 240585
Matthias Braun [Wed, 24 Jun 2015 20:04:26 +0000 (20:04 +0000)]
Revert "(HEAD -> master, origin/master, origin/HEAD) opt: Add option to strip or add llvm value names"
Accidental commit
This reverts commit r240583.
llvm-svn: 240584
Matthias Braun [Wed, 24 Jun 2015 20:03:33 +0000 (20:03 +0000)]
opt: Add option to strip or add llvm value names
llvm-svn: 240583
Matthias Braun [Wed, 24 Jun 2015 20:03:27 +0000 (20:03 +0000)]
ARMLoadStoreOptimizer: Fix errata 602117 handling and make testcase actually test for it
This fixes PR23912
Differential Revision: http://reviews.llvm.org/D10620
llvm-svn: 240582
Ed Maste [Wed, 24 Jun 2015 20:02:56 +0000 (20:02 +0000)]
Reduce FreeBSD log spam
The values of four important registers are included in logs for ptrace
PT_GETREGS. Put all four on the same line for a more compact log. Also
use the proper 64-bit register names.
llvm-svn: 240581
Rafael Espindola [Wed, 24 Jun 2015 19:57:32 +0000 (19:57 +0000)]
Make computeSymbolSizes never fail.
On ELF that was already the case since getting the size of a symbol
never fails.
On MachO and COFF we could fail trying to get the section of a symbol. But
we don't really need the section, just the section number to know if two
symbols are in the same section or not.
llvm-svn: 240580
Alex Lorenz [Wed, 24 Jun 2015 19:56:10 +0000 (19:56 +0000)]
MIR Serialization: Serialize simple MachineRegisterInfo attributes.
This commit serializes the 3 scalar boolean attributes from the
MachineRegisterInfo class: IsSSA, TracksRegLiveness, and
TracksSubRegLiveness. These attributes are serialized as part
of the machine function YAML mapping.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10618
llvm-svn: 240579
Enrico Granata [Wed, 24 Jun 2015 19:53:22 +0000 (19:53 +0000)]
Fix an issue where an SBValue could end up capturing a synthetic value and would then be unable to return the non-synthetic version thereof
This patch makes the backing ValueImpl always store the root-most value no matter the "flavor" that is initially passed into it
llvm-svn: 240578
Dmitry Vyukov [Wed, 24 Jun 2015 19:49:32 +0000 (19:49 +0000)]
tsan: fix false positive between dlopen and dl_iterate_phdr
We see false reports between dlopen and dl_iterate_phdr.
This happens because tsan does not see dynamic linker
internal synchronization. Unpoison module names
in dl_iterate_phdr callback.
llvm-svn: 240576
Rafael Espindola [Wed, 24 Jun 2015 19:32:52 +0000 (19:32 +0000)]
Use Symbol::getValue to simplify object::computeSymbolSizes. NFC.
llvm-svn: 240575
Steven Wu [Wed, 24 Jun 2015 19:30:36 +0000 (19:30 +0000)]
Remove environment variables from driver tests
Summary:
Remove some of dangerous environmental variables from clang/Driver tests.
Driver tests should not rely on preset value of these variables and may
actually fail because of them.
They cannot be removed in test/lit.cfg because we still need to support
relocatable SDKs and other overwrite for other clang tests.
Reviewers: bogner
Subscribers: rnk, cfe-commits
Differential Revision: http://reviews.llvm.org/D7135
llvm-svn: 240574
Jingyue Wu [Wed, 24 Jun 2015 19:28:40 +0000 (19:28 +0000)]
[LSR] canonicalize Prod*(1<<C) to Prod<<C
Summary:
Because LSR happens at a late stage where mul of a power of 2 is
typically canonicalized to shl, this canonicalization emits code that
can be better CSE'ed.
Test Plan:
Transforms/LoopStrengthReduce/shl.ll shows how this change makes GVN more
powerful. Fixes some existing tests due to this change.
Reviewers: sanjoy, majnemer, atrick
Reviewed By: majnemer, atrick
Subscribers: majnemer, llvm-commits
Differential Revision: http://reviews.llvm.org/D10448
llvm-svn: 240573
Rafael Espindola [Wed, 24 Jun 2015 19:27:53 +0000 (19:27 +0000)]
Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.
llvm-svn: 240572
Jordan Rose [Wed, 24 Jun 2015 19:27:02 +0000 (19:27 +0000)]
[Preprocessor] Iterating over all macros should include those from modules.
So, iterate over the list of macros mentioned in modules, and make sure those
are in the master table.
This isn't particularly efficient, but hopefully it's something that isn't
done too often.
PR23929 and rdar://problem/
21480635
llvm-svn: 240571
Adhemerval Zanella [Wed, 24 Jun 2015 19:26:00 +0000 (19:26 +0000)]
[ELF] Fix .init_array initialization
Some compilers may not add the section symbol in '.symtab' for the
.init_array and 'ldd' just ignore it. It results in global constructor
not being called in final executable.
This patch add both '.init_array' and '.fini_array' to be added in
Atom graph generation even when the section contains no symbol. An
already existing testcase is modified to check for such scenario.
The issue fixes the llvm test-suite regressions for both Single
and MultiSource files.
llvm-svn: 240570
Rafael Espindola [Wed, 24 Jun 2015 19:11:10 +0000 (19:11 +0000)]
Add a SymbolRef::getValue.
This returns either the symbol offset or address. Since it is not defined which
one, it never has to lookup the section and so never fails.
I will add users in the next commit.
llvm-svn: 240569
Pete Cooper [Wed, 24 Jun 2015 18:55:24 +0000 (18:55 +0000)]
Devirtualize Constant::replaceUsesOfWithOnConstant.
This is part of the work to devirtualize Value.
The old pattern was to call replaceUsesOfWithOnConstant which was overridden by
subclasses. Those could then call replaceUsesOfWithOnConstantImpl on Constant
to handle deleting the current value.
To be consistent with other parts of the code, this has been changed so that we
call the method on Constant, and that dispatches to an Impl on subclasses.
As part of this, it made sense to rename the methods to be more descriptive. The
new name is Constant::handleOperandChange, and it requires that all subclasses of
Constant implement handleOperandChangeImpl, even if they just throw an error if
they shouldn't be called.
Reviewed by Duncan Exon Smith.
llvm-svn: 240567
Duncan P. N. Exon Smith [Wed, 24 Jun 2015 18:48:11 +0000 (18:48 +0000)]
AsmPrinter: Cleanup DIEValue::EmitValue() API, NFC
Stop taking a `dwarf::Form` in `DIEValue::EmitValue()` and
`DIEValue::SizeOf()`, since they're always passed `DIEValue::getForm()`
anyway. This is just left over from when `DIEValue` didn't know its own
form.
llvm-svn: 240566
Oleksiy Vyalov [Wed, 24 Jun 2015 18:35:36 +0000 (18:35 +0000)]
Revert rL240435: "Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.".
llvm-svn: 240565
Peter Collingbourne [Wed, 24 Jun 2015 18:16:05 +0000 (18:16 +0000)]
SafeStack: Add another missing header to try to fix FreeBSD build.
llvm-svn: 240564
Rafael Espindola [Wed, 24 Jun 2015 18:14:41 +0000 (18:14 +0000)]
Refactor duplicated code. NFC.
llvm-svn: 240563
Peter Collingbourne [Wed, 24 Jun 2015 18:03:39 +0000 (18:03 +0000)]
Object: Add XFAILed test case for r239560.
We ought to also emit unmangled references to dllimported functions,
but no existing linker needs this.
llvm-svn: 240562
Bruno Cardoso Lopes [Wed, 24 Jun 2015 17:53:17 +0000 (17:53 +0000)]
[CaptureTracking] Avoid long compilation time on large basic blocks
CaptureTracking becomes very expensive in large basic blocks while
calling PointerMayBeCaptured. PointerMayBeCaptured scans the BB the
number of times equal to the number of uses of 'BeforeHere', which is
currently capped at 20 and bails out with Tracker->tooManyUses().
The bottleneck here is the number of calls to PointerMayBeCaptured * the
basic block scan. In a testcase with a 82k instruction BB,
PointerMayBeCaptured is called 130k times, leading to 'shouldExplore'
taking 527k runs, this currently takes ~12min.
To fix this we locally (within PointerMayBeCaptured) number the
instructions in the basic block using a DenseMap to cache instruction
positions/numbers. We build the cache incrementally every time we need
to scan an unexplored part of the BB, improving compile time to only
take ~2min.
This triggers in the flow: DeadStoreElimination -> MepDepAnalysis ->
CaptureTracking.
Side note: after multiple runs in the test-suite I've seen no
performance nor compile time regressions, but could note a couple of
compile time improvements:
Performance Improvements - Compile Time Delta Previous Current StdDev
SingleSource/Benchmarks/Misc-C++/bigfib -4.48% 0.8547 0.8164 0.0022
MultiSource/Benchmarks/TSVC/LoopRerolling-dbl/LoopRerolling-dbl -1.47% 1.3912 1.3707 0.0056
Differential Revision: http://reviews.llvm.org/D7010
llvm-svn: 240560
Alex Lorenz [Wed, 24 Jun 2015 17:34:58 +0000 (17:34 +0000)]
MIR Serialization: Serialize the null register operands.
This commit serializes the null register machine operands.
It uses the '_' keyword to represent them, but the parser
also allows the '%noreg' named register syntax.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10580
llvm-svn: 240558
Michael Zolotukhin [Wed, 24 Jun 2015 17:26:24 +0000 (17:26 +0000)]
[LoopVectorizer] Fix bailing-out condition for OptForSize case.
With option OptForSize enabled, the Loop Vectorizer is not supposed to
create tail loop. The condition checking that was invalid and was not
matching to the comment above.
Patch by Marianne Mailhot-Sarrasin.
llvm-svn: 240556
Peter Collingbourne [Wed, 24 Jun 2015 17:23:13 +0000 (17:23 +0000)]
SafeStack: Add #include of <stdint.h>.
Should fix the FreeBSD build.
llvm-svn: 240555
Rafael Espindola [Wed, 24 Jun 2015 17:08:44 +0000 (17:08 +0000)]
Simplify the logic, NFC.
llvm-svn: 240554
Alex Lorenz [Wed, 24 Jun 2015 17:05:04 +0000 (17:05 +0000)]
ADTTests: merge #ifdef checks from r240436.
This commit merges the #ifdef and #ifndef checks into one #if, as
suggested by Duncan P. N. Exon Smith.
llvm-svn: 240553
Tom Stellard [Wed, 24 Jun 2015 17:03:50 +0000 (17:03 +0000)]
prepare-builtins: Fix build with LLVM 3.7
llvm-svn: 240552
Chaoren Lin [Wed, 24 Jun 2015 16:41:39 +0000 (16:41 +0000)]
Remove xfail for TestDisassembleBreakpoint.
LLGS no longer returns trap code in memory.
llvm-svn: 240551
Ed Maste [Wed, 24 Jun 2015 16:39:22 +0000 (16:39 +0000)]
Remove SetResumeState from POSIXThread::RefreshStateAfterStop
With the removal of ProcessLinux in r240543 this code is used only on
FreeBSD. FreeBSD isn't affected by whichever issue originally prompted
the addition of SetResumeState, so just remove it.
As discussed on the mailing list (and mentioned in a FIXME comment)
it shouldn't be called there.
llvm-svn: 240550
Ed Maste [Wed, 24 Jun 2015 16:24:56 +0000 (16:24 +0000)]
Remove empty ProcessPOSIX::StopAllThreads
The removal of ProcessLinux in r240543 left only an empty
StopAllThreads (it's not needed on FreeBSD), so just remove it too.
llvm-svn: 240549
Daniel Jasper [Wed, 24 Jun 2015 16:01:02 +0000 (16:01 +0000)]
clang-format: [JS] Support regex literals containing quotes (' and ").
llvm-svn: 240548
Ed Maste [Wed, 24 Jun 2015 15:27:35 +0000 (15:27 +0000)]
Remove unused variable
llvm-svn: 240547
Ewan Crawford [Wed, 24 Jun 2015 15:14:26 +0000 (15:14 +0000)]
Proper handling of QNonStop packet response.
Turn non-stop mode off if reply to QNonStop packet isn't an OK.
llvm-svn: 240546
Douglas Katzman [Wed, 24 Jun 2015 15:10:30 +0000 (15:10 +0000)]
Express Driver::GetFilePath more concisely.
llvm-svn: 240545
Rafael Espindola [Wed, 24 Jun 2015 14:48:54 +0000 (14:48 +0000)]
Don't get confused with sections whose section number is reserved.
It is perfectly possible for SHNDX to contain indexes that have the same value
as reserved st_shndx values.
llvm-svn: 240544
Pavel Labath [Wed, 24 Jun 2015 14:43:20 +0000 (14:43 +0000)]
Remove old local-only linux debugging code
Summary:
Currently, the local-only path fails about 50% of the tests, which means that: a) nobody is using
it; and b) the remote debugging path is much more stable. This commit removes the local-only
linux debugging code (ProcessLinux) and makes remote-loopback the only way to debug local
applications (the same architecture as OSX). The ProcessPOSIX code is moved to the FreeBSD
directory, which is now the only user of this class. Hopefully, FreeBSD will soon move to the new
architecture as well and then this code can be removed completely.
Test Plan: Test suite passes via remote stub.
Reviewers: emaste, vharron, ovyalov, clayborg
Subscribers: tberghammer, emaste, lldb-commits
Differential Revision: http://reviews.llvm.org/D10661
llvm-svn: 240543
Simon Pilgrim [Wed, 24 Jun 2015 13:52:25 +0000 (13:52 +0000)]
[X86][AVX] Added full set of 256-bit vector shift tests.
llvm-svn: 240542
Dmitry Vyukov [Wed, 24 Jun 2015 13:27:56 +0000 (13:27 +0000)]
asan: fix 32-bit build
llvm-svn: 240541
Daniel Sanders [Wed, 24 Jun 2015 13:25:57 +0000 (13:25 +0000)]
Eliminate additional redundant copies of Triple objects. NFC.
Subscribers: rafael, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10654
llvm-svn: 240540
Dmitry Vyukov [Wed, 24 Jun 2015 13:04:12 +0000 (13:04 +0000)]
tsan: don't print external PCs in reports
They are meaningless.
llvm-svn: 240539
Pawel Bylica [Wed, 24 Jun 2015 12:49:42 +0000 (12:49 +0000)]
Fix instruction scheduling live register tracking
Summary:
This patch fixes PR23405 (https://llvm.org/bugs/show_bug.cgi?id=23405).
During a node unscheduling an entry in LiveRegGens can be replaced with a new value. That corrupts the live reg tracking and LiveReg* structure is not cleared as should be during unscheduling. Problematic condition that enforces Gen replacement is `I->getSUnit()->getHeight() < LiveRegGens[I->getReg()]->getHeight()`. This condition should be checked only if LiveRegGen was set in current node unscheduling.
Test Plan: Regression test included.
Reviewers: hfinkel, atrick
Reviewed By: atrick
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9993
llvm-svn: 240538
Tamas Berghammer [Wed, 24 Jun 2015 12:31:25 +0000 (12:31 +0000)]
Fix location of symbol size calculation in ObjectFileELF
Bug introduced by r240533
llvm-svn: 240537
Aaron Ballman [Wed, 24 Jun 2015 12:11:04 +0000 (12:11 +0000)]
Silencing some Sphinx warnings about duplicate explicit target names.
llvm-svn: 240536
Dmitry Vyukov [Wed, 24 Jun 2015 11:51:41 +0000 (11:51 +0000)]
tsan: fix unbounded memory consumption for large mallocs
This happens only in corner cases, but we observed this on a real app.
See the test for description of the exact scenario that lead to unbounded memory consumption.
llvm-svn: 240535
Pawel Bylica [Wed, 24 Jun 2015 11:49:44 +0000 (11:49 +0000)]
[llvm-stress] Simple refactoring and better style. NFC.
llvm-svn: 240534
Tamas Berghammer [Wed, 24 Jun 2015 11:27:32 +0000 (11:27 +0000)]
Improve instruction emulation based stack unwinding on ARM
* Add and fix the emulation of several instruction.
* Disable frame pointer usage on Android.
* Specify return address register for the unwind plan instead of explict
tracking the value of RA.
* Replace prologue detection heuristics (unreliable in several cases)
with a logic to follow the branch instructions and restore the CFI
value based on them. The target address for a branch should have the
same CFI as the source address (if they are in the same function).
* Handle symbols in ELF files where the symbol size is not specified
with calcualting their size based on the next symbol (already done
in MachO files).
* Fix architecture in FuncUnwinders with filling up the inforamtion
missing from the object file with the architecture of the target.
* Add code to read register wehn the value is set to "IsSame" as it
meanse the value of a register in the parent frame is the same as the
value in the current frame.
Differential revision: http://reviews.llvm.org/D10447
llvm-svn: 240533
Alexey Bataev [Wed, 24 Jun 2015 11:01:36 +0000 (11:01 +0000)]
[OPENMP] Codegen for 'depend' clause (OpenMP 4.0).
If task directive has associated 'depend' clause then function kmp_int32 __kmpc_omp_task_with_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task, kmp_int32 ndeps, kmp_depend_info_t *dep_list,kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called instead of __kmpc_omp_task().
If this directive has associated 'if' clause then also before a call of kmpc_omp_task_begin_if0() a function void __kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called.
Array sections are not supported yet.
llvm-svn: 240532
Zoran Jovanovic [Wed, 24 Jun 2015 10:32:16 +0000 (10:32 +0000)]
[mips][microMIPS] Implement BREAK, EHB and EI instructions
http://reviews.llvm.org/D10090
llvm-svn: 240531
Chandler Carruth [Wed, 24 Jun 2015 10:24:30 +0000 (10:24 +0000)]
Remove a limited and somewhat questionable DenseMapInfo specialization
for StringRef now that the core DenseMap library provides this facility.
llvm-svn: 240530
Rafael Espindola [Wed, 24 Jun 2015 10:20:30 +0000 (10:20 +0000)]
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that
in the class hierarchy by having a method for common symbols only in the base
and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few
problems
* Most callers didn't check for it.
* The ones that did could not tell the magic value from a file actually having
that value.
llvm-svn: 240529
Chandler Carruth [Wed, 24 Jun 2015 10:06:29 +0000 (10:06 +0000)]
[ADT] Teach DenseMap to support StringRef keys.
While often you want to use something specialized like StringMap, when
the strings already have persistent storage a normal densemap over them
can be more efficient.
This can't go into StringRef.h because of really obnoxious header chains
from the hashing code to the endian detection code to CPU feature
detection code to StringMap.
llvm-svn: 240528
Ed Schouten [Wed, 24 Jun 2015 08:44:38 +0000 (08:44 +0000)]
Make support for thread-unsafe C functions optional.
One of the aspects of CloudABI is that it aims to help you write code
that is thread-safe out of the box. This is very important if you want
to write libraries that are easy to reuse. For CloudABI we decided to
not provide the thread-unsafe functions. So far this is working out
pretty well, as thread-unsafety issues are detected really early on.
The following patch adds a knob to libc++,
_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS, that can be set to disable
thread-unsafe functions that can easily be avoided in practice. The
following functions are not thread-safe:
- <clocale>: locale handles should be preferred over setlocale().
- <cstdlib>: mbrlen(), mbrtowc() and wcrtomb() should be preferred over
their non-restartable counterparts.
- <ctime>: asctime(), ctime(), gmtime() and localtime() are not
thread-safe. The first two are also deprecated by POSIX.
Differential Revision: http://reviews.llvm.org/D8703
Reviewed by: marshall
llvm-svn: 240527
Justin Bogner [Wed, 24 Jun 2015 07:03:07 +0000 (07:03 +0000)]
Hexagon: Paper over the undefined behaviour introduced by r238692
This stops shifting a 32-bit value by such absurd amounts as 96 and
120. We do this by dropping a call to the function that was doing this
entirely, which rather surprisingly doesn't break *any* tests.
I've also added an assert in the misbehaving function to prove that
it's no longer being called with completely invalid arguments.
This change looks pretty bogus and we should probably be reverting
r238692 instead, but this is hard to do with the number of follow ups
that have happened since. It can't be any worse than the undefined
behaviour that was happening before though.
llvm-svn: 240526
NAKAMURA Takumi [Wed, 24 Jun 2015 06:40:09 +0000 (06:40 +0000)]
MILexer.cpp: Try to fix a warning. [-Wsign-compare]
llvm-svn: 240525
Craig Topper [Wed, 24 Jun 2015 06:19:19 +0000 (06:19 +0000)]
[TableGen] Restore the use of the TheInit field in Record to cache the Record's DefInit. I broke this when I fixed memory leaks recently. Remove the DenseMap that mapped Record's to DefInit.
llvm-svn: 240524
Bob Wilson [Wed, 24 Jun 2015 06:07:41 +0000 (06:07 +0000)]
Do not treat ARM _MoveToCoprocessor* intrinsics as MSBuiltins.
Those builtins are now handled via ad-hoc code in clang with r240522 to
deal with reordering the arguments to fix PR22560.
llvm-svn: 240523
Bob Wilson [Wed, 24 Jun 2015 06:05:20 +0000 (06:05 +0000)]
Move the special-case check from r240462 into ARM-specific code.
This fixes a serious bug in r240462: checking the BuiltinID for
ARM::BI_MoveToCoprocessor* in EmitBuiltinExpr() ignores the fact that
each target has an overlapping range of the BuiltinID values. That check
can trigger for builtins from other targets, leading to very bad
behavior.
Part of the reason I did not implement r240462 this way to begin with is
the special handling of the last argument for Neon builtins. In this
change, I have factored out the check to see which builtins have that
extra argument into a new HasExtraNeonArgument() function. There is still
some awkwardness in having to check for those builtins in two separate
places, i.e., once to see if the extra argument is present and once to
generate the appropriate IR, but this seems much cleaner than my previous
patch.
llvm-svn: 240522
Justin Bogner [Wed, 24 Jun 2015 06:00:53 +0000 (06:00 +0000)]
Hexagon: Avoid left shifting negative values (it's UB)
Found by ubsan.
llvm-svn: 240521
Justin Bogner [Wed, 24 Jun 2015 05:59:19 +0000 (05:59 +0000)]
SystemZ: Rephrase this allOnes calculation to avoid UB
This allOnes function hits undefined behaviour if Count is greater
than 64, but we can avoid that and simplify the calculation by just
saturating if such a value is passed in.
This comes up under ubsan becauseRxSBGOperands is sometimes created
with values that are 128 bits wide. Somebody more familiar with this
code should probably look into whether that's expected, as a 64 bit
mask may or may not be appropriate for such types.
llvm-svn: 240520
Rui Ueyama [Wed, 24 Jun 2015 04:36:52 +0000 (04:36 +0000)]
COFF: Initial implementation of Identical COMDAT Folding.
Identical COMDAT Folding (ICF) is an optimization to reduce binary
size by merging COMDAT sections that contain the same metadata,
actual data and relocations. MSVC link.exe and many other linkers
have this feature. LLD achieves on per with MSVC in terms produced
binary size with this patch.
This technique is pretty effective. For example, LLD's size is
reduced from 64MB to 54MB by enaling this optimization.
The algorithm implemented in this patch is extremely inefficient.
It puts all COMDAT sections into a set to identify duplicates.
Time to self-link with/without ICF are 3.3 and 320 seconds,
respectively. So this option roughly makes LLD 100x slower.
But it's okay as I wanted to achieve correctness first.
LLD is still able to link itself with this optimization.
I'm going to make it more efficient in followup patches.
Note that this optimization is *not* entirely safe. C/C++ require
different functions have different addresses. If your program
relies on that property, your program wouldn't work with ICF.
However, it's not going to be an issue on Windows because MSVC
link.exe turns ICF on by default. As long as your program works
with default settings (or not passing /opt:noicf), your program
would work with LLD too.
llvm-svn: 240519
Tobias Grosser [Wed, 24 Jun 2015 04:13:29 +0000 (04:13 +0000)]
Add support for srem instruction
Remainder operations with constant divisor can be modeled as quasi-affine
expression. This patch adds support for detecting and modeling them. We also
add a test that ensures they are correctly code generated.
This patch was extracted from a larger patch contributed by Johannes Doerfert
in http://reviews.llvm.org/D5293
llvm-svn: 240518
Alexey Bataev [Wed, 24 Jun 2015 03:35:38 +0000 (03:35 +0000)]
Proper changing/restoring for CapturedStmtInfo, NFC.
Added special RAII class for proper values changing/restoring in CodeGenFunction::CapturedStmtInfo.
llvm-svn: 240517
Rafael Espindola [Wed, 24 Jun 2015 03:19:35 +0000 (03:19 +0000)]
Don't repeat name in comments.
llvm-svn: 240516
Peter Collingbourne [Wed, 24 Jun 2015 00:12:36 +0000 (00:12 +0000)]
COFF: Remove unused field SectionChunk::SectionIndex.
llvm-svn: 240512