Colin LeMahieu [Tue, 16 Jun 2015 17:32:45 +0000 (17:32 +0000)]
[Hexagon] unused-local-typedef warning test is passing.
llvm-svn: 239832
Alex Lorenz [Tue, 16 Jun 2015 17:06:29 +0000 (17:06 +0000)]
MIR Parser: Report an error when a machine function doesn't have a corresponding function.
This commit reports an error when a machine function from a MIR file that contains
LLVM IR can't find a function with the same name in the loaded LLVM IR module.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10468
llvm-svn: 239831
Tamas Berghammer [Tue, 16 Jun 2015 16:58:34 +0000 (16:58 +0000)]
Fix compile error in TestCxxWCharT on Linux
llvm-svn: 239830
Rafael Espindola [Tue, 16 Jun 2015 16:36:15 +0000 (16:36 +0000)]
Add a test for padded bitcode files.
llvm-svn: 239829
Sanjay Patel [Tue, 16 Jun 2015 16:25:43 +0000 (16:25 +0000)]
propagate IR-level fast-math-flags to DAG nodes, disabled by default
This is an updated version of the patch that was checked in at:
http://reviews.llvm.org/rL237046
but subsequently reverted because it exposed a bug in the DAG Combiner:
http://reviews.llvm.org/D9893
This time, there's an enablement flag ("EnableFMFInDAG") around the code in
SelectionDAGBuilder where we copy the set of FP optimization flags from IR
instructions to DAG nodes. So, in theory, there should be no functional change
from this patch as-is, but it will allow testing with the added functionality
to proceed via "-enable-fmf-dag" passed to llc.
This patch adds the minimum plumbing necessary to use IR-level
fast-math-flags (FMF) in the backend without actually using
them for anything yet. This is a follow-on to:
http://reviews.llvm.org/rL235997
Differential Revision: http://reviews.llvm.org/D10403
llvm-svn: 239828
Kit Barton [Tue, 16 Jun 2015 16:01:15 +0000 (16:01 +0000)]
Properly handle the mftb instruction.
The mftb instruction was incorrectly marked as deprecated in the PPC
Backend. Instead, it should not be treated as deprecated, but rather be
implemented using the mfspr instruction. A similar patch was put into GCC last
year. Details can be found at:
https://sourceware.org/ml/binutils/2014-11/msg00383.html.
This change will replace instances of the mftb instruction with the mfspr
instruction for all CPUs except 601 and pwr3. This will also be the default
behaviour.
Additional details can be found in:
https://llvm.org/bugs/show_bug.cgi?id=23680
Phabricator review: http://reviews.llvm.org/D10419
llvm-svn: 239827
Colin LeMahieu [Tue, 16 Jun 2015 15:59:53 +0000 (15:59 +0000)]
[Hexagon] Alphabetical ordering of functions, NFC.
llvm-svn: 239826
Matt Arsenault [Tue, 16 Jun 2015 15:51:48 +0000 (15:51 +0000)]
Revert "Revert "Fix merges of non-zero vector stores""
Reapply r239539. Don't assume the collected number of
stores is the same vector size. Just take the first N
stores to fill the vector.
llvm-svn: 239825
Ewan Crawford [Tue, 16 Jun 2015 15:50:18 +0000 (15:50 +0000)]
Add Read Thread to GDBRemoteCommunication
In order to support asynchronous notifications for non-stop mode this patch adds a packet read thread. This is done by implementing AppendBytesToCache() from the communications class, which continually reads packets into a packet queue. To initialize this thread StartReadThread() must be called by the client, so since llgs and platform tools use the GBDRemoteCommunicatos code they must also call this function as well as ProcessGDBRemote.
When the read thread detects an async notify packet it broadcasts this event, where the matching listener will be added in the next non-stop patch.
Packets are now accessed by calling ReadPacket() which pops a packet from the queue, instead of using WaitForPacketWithTimeoutMicroSecondsNoLock()
Reviewers: vharron, clayborg
Subscribers: lldb-commits, labath, ted, domipheus, deepak2427
Differential Revision: http://reviews.llvm.org/D10085
llvm-svn: 239824
Daniel Sanders [Tue, 16 Jun 2015 15:44:21 +0000 (15:44 +0000)]
Clean up redundant copies of Triple objects. NFC
Summary:
Reviewers: rengolin
Reviewed By: rengolin
Subscribers: llvm-commits, rengolin, jholewinski
Differential Revision: http://reviews.llvm.org/D10382
llvm-svn: 239823
Ulrich Weigand [Tue, 16 Jun 2015 15:21:47 +0000 (15:21 +0000)]
[SystemZ] Mangle long double as __float128
In r239421, the mangling of long double on PowerPC Linux targets
was changed to use "g" instead of "e". This same change also needs
to be done for SystemZ (all targets, since we support only Linux
on SystemZ anyway).
This is because an old ABI variant set "long double" to a 64-bit
type equivalent to "double", and the "e" mangling code is still
used to refer to that old ABI for compatibility reasons.
llvm-svn: 239822
Benjamin Kramer [Tue, 16 Jun 2015 14:57:29 +0000 (14:57 +0000)]
[InstSimplify] Allow folding of fdiv X, X with just NaNs ignored
Any combination of +-inf/+-inf is NaN so it's already ignored with
nnan and we can skip checking for ninf. Also rephrase logic in comments
a bit.
llvm-svn: 239821
Daniel Marjamaki [Tue, 16 Jun 2015 14:27:31 +0000 (14:27 +0000)]
clang-tidy: Add checker that warns about missing parentheses in macros
* calculations in the replacement list should be inside parentheses
* macro arguments should be inside parentheses
llvm-svn: 239820
James Y Knight [Tue, 16 Jun 2015 14:00:01 +0000 (14:00 +0000)]
Repair cmake libatomic check.
The cmake check for whether libatomic could be used had been
unconditionally setting the result to false. Which was somewhat
fortunate, because the prerequisite check for whether it was *needed*
was always claiming it was, even if it was not.
However, this made platforms where libatomic is actually necessary
fail to link.
Differential Revision: http://reviews.llvm.org/D10453
llvm-svn: 239819
Toma Tabacu [Tue, 16 Jun 2015 13:54:13 +0000 (13:54 +0000)]
[mips] Don't propagate -mfpxx by default if soft/single float were also set.
Summary:
If the driver is only given -msoft-float/-mfloat-abi=soft or -msingle-float,
we should refrain from propagating -mfpxx, unless it was explicitly given on the
command line.
Reviewers: atanasyan, dsanders
Reviewed By: atanasyan, dsanders
Subscribers: cfe-commits, mpf
Differential Revision: http://reviews.llvm.org/D10387
llvm-svn: 239818
Daniel Sanders [Tue, 16 Jun 2015 13:46:26 +0000 (13:46 +0000)]
[mips][ias] Expand on r238751 to cover as many relocs as possible.
Summary:
Relocs that can be converted from absolute to PC-relative now do so if IsPCRel
is true. Relocs that require PC-relative now call llvm_unreachable() if IsPCRel
is false and similarly those that require absolute assert that IsPCRel is false.
Note that while it looks like some relocs (e.g. R_MIPS_26) can be converted into
the MIPS32r6/MIPS64r6 relocs (R_MIPS_PC*_S2), it isn't actually valid to do so.
Placeholders have been left in the testcase for unsupported relocs and relocs
that cannot be generated at the moment.
Reviewers: vkalintiris
Reviewed By: vkalintiris
Subscribers: llvm-commits, rafael
Differential Revision: http://reviews.llvm.org/D10184
llvm-svn: 239817
Daniel Jasper [Tue, 16 Jun 2015 13:15:54 +0000 (13:15 +0000)]
Avoid using set::emplace as it is apparently not supported by gcc 4.7.
llvm-svn: 239816
Daniel Sanders [Tue, 16 Jun 2015 13:15:50 +0000 (13:15 +0000)]
Replace string GNU Triples with llvm::Triple in TargetMachine::getTargetTriple(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.
Reviewers: rengolin
Reviewed By: rengolin
Subscribers: llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10381
llvm-svn: 239815
Aaron Ballman [Tue, 16 Jun 2015 13:14:59 +0000 (13:14 +0000)]
Silence an MSVC warning about not all control paths returning a value; NFC.
llvm-svn: 239814
Alexey Bataev [Tue, 16 Jun 2015 13:14:42 +0000 (13:14 +0000)]
[OPENMP] Support lastprivate clause in omp simd directive.
Added codegen for lastprivate clauses within simd loop-based directives.
llvm-svn: 239813
Daniel Sanders [Tue, 16 Jun 2015 12:18:07 +0000 (12:18 +0000)]
Recommit r239721: Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
Summary:
This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. Clang has been updated with a trivial
patch (not covered by the pre-commit review) to avoid breaking -Werror builds.
Other in-tree tools will be fixed with similar patches.
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.
The first time this was committed it accidentally fixed an inconsistency in
triples in llvm-mc and this caused a failure. This inconsistency was fixed in
r239808.
Reviewers: rengolin
Reviewed By: rengolin
Subscribers: llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10366
llvm-svn: 239812
Toma Tabacu [Tue, 16 Jun 2015 12:16:24 +0000 (12:16 +0000)]
[mips] [IAS] Refactor symbol-address loading code into a helper function. NFC.
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9523
llvm-svn: 239811
Alexey Bataev [Tue, 16 Jun 2015 11:59:36 +0000 (11:59 +0000)]
[OPENMP] Remove last iteration separation for loop-based constructs.
Previously the last iteration for simd loop-based OpenMP constructs were generated as a separate code. This feature is not required and codegen is simplified.
llvm-svn: 239810
Daniel Jasper [Tue, 16 Jun 2015 10:22:10 +0000 (10:22 +0000)]
Tooling: When applying a set of replacements, do deletions before
insertions. It is unlikely to be the intention to delete parts of newly
inserted code. To do so, changed sorting Replacements at the same offset
to have decreasing length.
llvm-svn: 239809
Daniel Sanders [Tue, 16 Jun 2015 09:57:38 +0000 (09:57 +0000)]
[llvm-mc] The object form of the GNU triple should be the same as the string form.
Summary:
GetTarget() may modify TripleName without also updating TheTriple.
This can lead to situations where the MCObjectStreamer has a different triple
to the rest of LLVM.
This inconsistency caused sparc-little-endian.s to pass on Windows because most
of LLVM had sparcel-pc-win32 while MCObjectStreamer had "". I believe the same
kind of thing was also true of Darwin.
Reviewers: rengolin
Reviewed By: rengolin
Subscribers: llvm-commits, rengolin, rafael
Differential Revision: http://reviews.llvm.org/D10450
llvm-svn: 239808
Arnaud A. de Grandmaison [Tue, 16 Jun 2015 08:57:21 +0000 (08:57 +0000)]
[MachineSink] Address post-commit review comments
The successors cache is now a local variable, making it more visible that it
is only valid for the MBB being processed.
llvm-svn: 239807
Asaf Badouh [Tue, 16 Jun 2015 08:39:27 +0000 (08:39 +0000)]
[AVX512] add integer min/max intrinsics support.
review:
http://reviews.llvm.org/D10439
llvm-svn: 239806
NAKAMURA Takumi [Tue, 16 Jun 2015 06:57:35 +0000 (06:57 +0000)]
Disable llvm/test/CodeGen/MIR/machine-function.mir on x86 msc18 for now. Investigating.
The emission was as below;
---
name: foo
alignment:
31428584
exposesReturnsTwice: true
hasInlineAsm: false
...
---
name: bar
alignment:
1701667182
exposesReturnsTwice: false
hasInlineAsm: false
...
---
name: func
alignment: 8
exposesReturnsTwice: false
hasInlineAsm: false
...
---
name: func2
alignment: 16
exposesReturnsTwice: true
hasInlineAsm: true
...
llvm-svn: 239805
NAKAMURA Takumi [Tue, 16 Jun 2015 06:46:16 +0000 (06:46 +0000)]
llvm/unittests/Support/Path.cpp: Use <windows.h> instead of <Windows.h>.
llvm-svn: 239804
Justin Bogner [Tue, 16 Jun 2015 06:24:15 +0000 (06:24 +0000)]
InstrProf: Fix coverage mapping when "if" is a macro
We were propagating the coverage map into the body of an if statement,
but not into the condition thereafter. This is fine as long as the two
locations are in the same virtual file, but they won't be when the
"if" part of the statement is from a macro and the condition is not.
llvm-svn: 239803
Elena Demikhovsky [Tue, 16 Jun 2015 06:07:24 +0000 (06:07 +0000)]
X86: optimized i64 vector multiply with constant
When we multiply two 64-bit vectors, we extract lower and upper part and use the PMULUDQ instruction.
When one of the operands is a constant, the upper part may be zero, we know this at compile time.
Example: %a = mul <4 x i64> %b, <4 x i64> < i64 5, i64 5, i64 5, i64 5>.
I'm checking the value of the upper part and prevent redundant "multiply", "shift" and "add" operations.
llvm-svn: 239802
Craig Topper [Tue, 16 Jun 2015 05:44:06 +0000 (05:44 +0000)]
[TableGen] Remove unused method declaration. NFC
llvm-svn: 239801
Philip Reames [Tue, 16 Jun 2015 01:20:53 +0000 (01:20 +0000)]
Revert 239795
I forgot to update some clang test cases. I'll fix and resubmit tomorrow.
llvm-svn: 239800
Ahmed Bougacha [Tue, 16 Jun 2015 01:18:14 +0000 (01:18 +0000)]
[AArch64] Generalize extract-high DUP extension to MOVI/MVNI.
These are really immediate DUPs, and suffer from the same problem
with long instructions with a high/2 variant (e.g. smull).
By extending a MOVI (or DUP, before this patch), we can avoid an ext
on the other operand of the long instruction, e.g. turning:
ext.16b v0, v0, v0, #8
movi.4h v1, #0x53
smull.4s v0, v0, v1
into:
movi.8h v1, #0x53
smull2.4s v0, v0, v1
While there, add a now-necessary combine to fold (VT NVCAST (VT x)).
llvm-svn: 239799
Ahmed Bougacha [Tue, 16 Jun 2015 01:05:39 +0000 (01:05 +0000)]
[AArch64] Robustize neon-2velem-high test. NFC.
llvm-svn: 239798
Philip Reames [Tue, 16 Jun 2015 00:49:59 +0000 (00:49 +0000)]
Move logic from JumpThreading into LazyValue info to simplify caller.
This change is hopefully NFC. The only tricky part is that I changed the context instruction being used to the branch rather than the comparison. I believe both to be correct, but the branch is strictly more powerful. With the moved code, using the branch instruction is required for the basic block comparison test to return the same result. The previous code was able to directly access both the branch and the comparison where the revised code is not.
Differential Revision: http://reviews.llvm.org/D9652
llvm-svn: 239797
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:44:12 +0000 (00:44 +0000)]
modules: Add explicit dependency on intrinsics_gen
`LLVM_ENABLE_MODULES` builds sometimes fail because `Intrinsics.td`
needs to regenerate `Instrinsics.h` before anyone can include anything
from the LLVM_IR module. Represent the dependency explicitly to prevent
that.
llvm-svn: 239796
Philip Reames [Tue, 16 Jun 2015 00:43:54 +0000 (00:43 +0000)]
[InstCombine] Propagate non-null facts to call parameters
If a parameter to a function is known non-null, use the existing parameter attributes to record that fact at the call site. This has no optimization benefit by itself - that I know of - but is an enabling change for http://reviews.llvm.org/D9129.
Differential Revision: http://reviews.llvm.org/D9132
llvm-svn: 239795
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:43:52 +0000 (00:43 +0000)]
modules: Mark CodeGen/DIEValues.def as a textual inclusion
Mark CodeGen/DIEValues.def as a textual inclusion to fix the
`LLVM_ENABLE_MODULES` build.
llvm-svn: 239794
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:43:04 +0000 (00:43 +0000)]
modules: Move ProfileKinds to an anonymous namespace
Fix a build failure with `LLVM_ENABLE_MODULES` due to
`ProfileData::instr` conflicting with a function `instr()` in
`<curses.h>`.
llvm-svn: 239793
Richard Smith [Tue, 16 Jun 2015 00:20:23 +0000 (00:20 +0000)]
[modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise for
-fno-module-maps). The old names are preserved for compatibility.
llvm-svn: 239792
Richard Smith [Tue, 16 Jun 2015 00:19:29 +0000 (00:19 +0000)]
Commit some test changes somehow missed in r239789.
llvm-svn: 239791
Alex Lorenz [Tue, 16 Jun 2015 00:10:47 +0000 (00:10 +0000)]
MIR Serialization: Print and parse simple machine function attributes.
This commit serializes the simple, scalar attributes from the
'MachineFunction' class.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10449
llvm-svn: 239790
Richard Smith [Tue, 16 Jun 2015 00:08:24 +0000 (00:08 +0000)]
[modules] Simplify -cc1 interface for enabling implicit module maps.
We used to have a flag to enable module maps, and two more flags to enable
implicit module maps. This is all redundant; we don't need any flag for
enabling module maps in the abstract, and we don't usually have -fno- flags for
-cc1. We now have just a single flag, -fimplicit-module-maps, that enables
implicitly searching the file system for module map files and loading them.
The driver interface is unchanged for now. We should probably rename
-fmodule-maps to -fimplicit-module-maps at some point.
llvm-svn: 239789
Alex Lorenz [Mon, 15 Jun 2015 23:52:35 +0000 (23:52 +0000)]
MIR Serialization: move the MIR printer out of the MIR printing pass.
This commit decouples the MIR printer and the MIR printing pass so
that it will be possible to move the MIR printer into a separate
machine IR library later on.
Reviewers: Duncan P. N. Exon Smith
llvm-svn: 239788
Richard Smith [Mon, 15 Jun 2015 23:52:34 +0000 (23:52 +0000)]
[modules] Remove non-functional driver options -f[no-]modules-implicit-maps.
These driver options never did anything (they weren't forwarded to the
frontend). Also update the documentation to not mention them.
llvm-svn: 239787
Reid Kleckner [Mon, 15 Jun 2015 23:45:08 +0000 (23:45 +0000)]
[X86] Try to shorten dwarf CFI emission
llvm-svn: 239786
Filipe Cabecinhas [Mon, 15 Jun 2015 23:44:53 +0000 (23:44 +0000)]
[ASan tests] Revert a bad change from r239754
Hopefully the last partial revert. Sorry about the noise.
llvm-svn: 239785
Samuel Antao [Mon, 15 Jun 2015 23:44:27 +0000 (23:44 +0000)]
According to the OpenMP spec, all the preprocessor macros should be
expanded in OpenMP pragmas. This patch adds support for that in -E.
llvm-svn: 239784
Richard Smith [Mon, 15 Jun 2015 23:39:16 +0000 (23:39 +0000)]
[modules] Re-enable accidentally-disabled test.
llvm-svn: 239783
Eric Christopher [Mon, 15 Jun 2015 23:20:35 +0000 (23:20 +0000)]
Use a macro for the omnipresent attributes on header functions in Intrin.h.
Saves some typing and if someone wants to change them it makes it much easier.
llvm-svn: 239782
Adrian Prantl [Mon, 15 Jun 2015 23:18:16 +0000 (23:18 +0000)]
Debug Info: Turn on ODR type uniquing for (the C++ part of) Objective-C++.
rdar://problem/
20571359
llvm-svn: 239781
Adrian Prantl [Mon, 15 Jun 2015 23:18:03 +0000 (23:18 +0000)]
Debug Info IR: Switch DIObjCProperty to use DITypeRef.
This is a prerequisite for turning on ODR type uniquing for ObjC++.
rdar://problem/
21377883
llvm-svn: 239780
Enrico Granata [Mon, 15 Jun 2015 23:12:29 +0000 (23:12 +0000)]
If a candidate keyword contains quotes, it's clearly not a keyword, so bail out early
There are other characters we could optimize for (any non-letter pretty much), but keyword.iskeyword() will handle them, whereas quotes do have the potential to confuse us, so they actually need custom handling
Fixes rdar://problem/
21022787
llvm-svn: 239779
Alex Lorenz [Mon, 15 Jun 2015 23:07:38 +0000 (23:07 +0000)]
MIR Serialization: Create dummy functions when the MIR file doesn't have LLVM IR.
This commit creates a dummy LLVM IR function with one basic block and an unreachable
instruction for each parsed machine function when the MIR file doesn't have LLVM IR.
This change is required as the machine function analysis pass creates machine
functions only for the functions that are defined in the current LLVM module.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10135
llvm-svn: 239778
Enrico Granata [Mon, 15 Jun 2015 23:01:47 +0000 (23:01 +0000)]
Add a formatter for wchar_t[N] arrays
rdar://
21299888
llvm-svn: 239777
Alex Lorenz [Mon, 15 Jun 2015 22:23:23 +0000 (22:23 +0000)]
MIR Serialization: Report an error when machine functions have the same name.
This commit reports an error when the MIR parser encounters a machine
function with the name that is the same as the name of a different
machine function.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10130
llvm-svn: 239774
Filipe Cabecinhas [Mon, 15 Jun 2015 22:19:47 +0000 (22:19 +0000)]
[ASan tests] Leftover that didn't get reverted in r239754
llvm-svn: 239773
Peter Collingbourne [Mon, 15 Jun 2015 22:16:51 +0000 (22:16 +0000)]
Add safestack attribute to LLVMAttribute enum and Go bindings. Correct
constants in commented-out part of LLVMAttribute enum. Add tests that verify
that the safestack attribute is only allowed as a function attribute.
llvm-svn: 239772
Filipe Cabecinhas [Mon, 15 Jun 2015 22:14:21 +0000 (22:14 +0000)]
[ASan tests] Use export, not env.
llvm-svn: 239771
Colin LeMahieu [Mon, 15 Jun 2015 21:57:41 +0000 (21:57 +0000)]
[Hexagon] Using readobj rather than objdump.
llvm-svn: 239770
Colin LeMahieu [Mon, 15 Jun 2015 21:52:13 +0000 (21:52 +0000)]
[Hexagon] PC-relative offsets are relative to packet start rather than the offset of the relocation. Set relocation addend and check it's correct in the ELF.
llvm-svn: 239769
Filipe Cabecinhas [Mon, 15 Jun 2015 21:49:35 +0000 (21:49 +0000)]
Revert "[ASan tests] Try to fix Windows buildbots due to r239754"
This reverts commit r239764 and the TestCases/Windows part of r239754.
llvm-svn: 239768
Simon Pilgrim [Mon, 15 Jun 2015 21:49:31 +0000 (21:49 +0000)]
[X86][SSE] Added tests for vector i8/i16 to f32/f64 conversions
llvm-svn: 239767
Enrico Granata [Mon, 15 Jun 2015 21:37:05 +0000 (21:37 +0000)]
Fix a bug where passing a value of the type "A B" to settings set target.env-vars would cause LLDB to crash
Fixes rdar://problem/
21241817
llvm-svn: 239766
Reid Kleckner [Mon, 15 Jun 2015 21:21:17 +0000 (21:21 +0000)]
Fix submodule test to pass on content addressable filesystems where inodes would collide
llvm-svn: 239765
Filipe Cabecinhas [Mon, 15 Jun 2015 21:15:26 +0000 (21:15 +0000)]
[ASan tests] Try to fix Windows buildbots due to r239754
llvm-svn: 239764
Peter Collingbourne [Mon, 15 Jun 2015 21:08:47 +0000 (21:08 +0000)]
Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library
This patch adds runtime support for the Safe Stack protection to compiler-rt
(see http://reviews.llvm.org/D6094 for the detailed description of the
Safe Stack).
This patch is our implementation of the safe stack on top of compiler-rt. The
patch adds basic runtime support for the safe stack to compiler-rt that
manages unsafe stack allocation/deallocation for each thread.
Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.
Differential Revision: http://reviews.llvm.org/D6096
llvm-svn: 239763
Peter Collingbourne [Mon, 15 Jun 2015 21:08:13 +0000 (21:08 +0000)]
Protection against stack-based memory corruption errors using SafeStack: Clang command line option and function attribute
This patch adds the -fsanitize=safe-stack command line argument for clang,
which enables the Safe Stack protection (see http://reviews.llvm.org/D6094
for the detailed description of the Safe Stack).
This patch is our implementation of the safe stack on top of Clang. The
patches make the following changes:
- Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang
to control safe stack usage (the safe stack is disabled by default).
- Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be
used to disable the safe stack for individual functions even when enabled
globally.
Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.
Differential Revision: http://reviews.llvm.org/D6095
llvm-svn: 239762
Peter Collingbourne [Mon, 15 Jun 2015 21:07:11 +0000 (21:07 +0000)]
Protection against stack-based memory corruption errors using SafeStack
This patch adds the safe stack instrumentation pass to LLVM, which separates
the program stack into a safe stack, which stores return addresses, register
spills, and local variables that are statically verified to be accessed
in a safe way, and the unsafe stack, which stores everything else. Such
separation makes it much harder for an attacker to corrupt objects on the
safe stack, including function pointers stored in spilled registers and
return addresses. You can find more information about the safe stack, as
well as other parts of or control-flow hijack protection technique in our
OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf)
and our project website (http://levee.epfl.ch).
The overhead of our implementation of the safe stack is very close to zero
(0.01% on the Phoronix benchmarks). This is lower than the overhead of
stack cookies, which are supported by LLVM and are commonly used today,
yet the security guarantees of the safe stack are strictly stronger than
stack cookies. In some cases, the safe stack improves performance due to
better cache locality.
Our current implementation of the safe stack is stable and robust, we
used it to recompile multiple projects on Linux including Chromium, and
we also recompiled the entire FreeBSD user-space system and more than 100
packages. We ran unit tests on the FreeBSD system and many of the packages
and observed no errors caused by the safe stack. The safe stack is also fully
binary compatible with non-instrumented code and can be applied to parts of
a program selectively.
This patch is our implementation of the safe stack on top of LLVM. The
patches make the following changes:
- Add the safestack function attribute, similar to the ssp, sspstrong and
sspreq attributes.
- Add the SafeStack instrumentation pass that applies the safe stack to all
functions that have the safestack attribute. This pass moves all unsafe local
variables to the unsafe stack with a separate stack pointer, whereas all
safe variables remain on the regular stack that is managed by LLVM as usual.
- Invoke the pass as the last stage before code generation (at the same time
the existing cookie-based stack protector pass is invoked).
- Add unit tests for the safe stack.
Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.
Differential Revision: http://reviews.llvm.org/D6094
llvm-svn: 239761
Rafael Espindola [Mon, 15 Jun 2015 21:04:27 +0000 (21:04 +0000)]
Don't indent inside a namespace. NFC.
llvm-svn: 239760
Rafael Espindola [Mon, 15 Jun 2015 21:02:49 +0000 (21:02 +0000)]
Replace @ with the more common \. NFC.
llvm-svn: 239759
Saleem Abdulrasool [Mon, 15 Jun 2015 20:57:04 +0000 (20:57 +0000)]
parser: improve diagnostics for MS attributes
Switch to using BalancedDelimiterTracker to get better diagnostics for
unbalanced delimiters. This still does not handle any of the attributes, simply
improves the parsing.
llvm-svn: 239758
Reid Kleckner [Mon, 15 Jun 2015 20:55:43 +0000 (20:55 +0000)]
Wildcard out some SSA value names from the ACLE intrinsic test case
llvm-svn: 239757
Rafael Espindola [Mon, 15 Jun 2015 20:55:37 +0000 (20:55 +0000)]
Don't repeat names in comments and start functions with a lower case letter.
llvm-svn: 239756
James Y Knight [Mon, 15 Jun 2015 20:51:24 +0000 (20:51 +0000)]
[Sparc] Make soft-float emit an error.
LLVM does not and has not ever supported a soft-float ABI mode on
Sparc, so don't pretend that it does.
Also switch the default from "soft-float" -- which was actually
hard-float because soft-float is unimplemented -- to hard-float.
Differential Revision: http://reviews.llvm.org/D10457
llvm-svn: 239755
Filipe Cabecinhas [Mon, 15 Jun 2015 20:43:42 +0000 (20:43 +0000)]
[ASan] Test churn for setting ASAN_OPTIONS=symbolize_vs_style=false
Summary:
This commit adds symbolize_vs_style=false to every instance of
ASAN_OPTIONS in the asan tests and sets
ASAN_OPTIONS=symbolize_vs_style=false in lit, for tests which don't set
it.
This way we don't need to make the tests be able to deal with both
symbolize styles.
This is the first patch in the series. I will eventually submit for the
other sanitizers too.
We need this change (or another way to deal with the different outputs) in
order to be able to default to symbolize_vs_style=true on some platforms.
Adding to this change, I'm also adding "env " before any command line
which sets environment variables. That way the test works on other host
shells, like we have if the host is running Windows.
Reviewers: samsonov, kcc, rnk
Subscribers: tberghammer, llvm-commits
Differential Revision: http://reviews.llvm.org/D10294
llvm-svn: 239754
Alex Lorenz [Mon, 15 Jun 2015 20:30:22 +0000 (20:30 +0000)]
MIR Serialization: Connect the machine function analysis pass to the MIR parser.
This commit connects the machine function analysis pass (which creates machine
functions) to the MIR parser, which will initialize the machine functions
with the state from the MIR file and reconstruct the machine IR.
This commit introduces a new interface called 'MachineFunctionInitializer',
which can be used to provide custom initialization for the machine functions.
This commit also introduces a new diagnostic class called
'DiagnosticInfoMIRParser' which is used for MIR parsing errors.
This commit modifies the default diagnostic handling in LLVMContext - now the
the diagnostics are printed directly into llvm::errs() so that the MIR parsing
errors can be printed with colours.
Reviewers: Justin Bogner
Differential Revision: http://reviews.llvm.org/D9928
llvm-svn: 239753
Greg Clayton [Mon, 15 Jun 2015 20:17:18 +0000 (20:17 +0000)]
Found an issue that was causing types to be completed much more often than they needed to be.
The problem is for lldb_private::Type instances that have encoding types (pointer/reference/const/volatile/restrict/typedef to type with user ID 0x123). If they started out with m_flags.clang_type_resolve_state being set to eResolveStateUnresolved (0), then when we would call Type::ResolveClangType(eResolveStateForward) we would complete the full type due to logic errors in the code.
We now only complete the type if clang_type_resolve_state is eResolveStateLayout or eResolveStateFull and we correctly upgrade the type's current completion state to eResolveStateForward after we make a forward delcaration to the pointer/reference/const/volatile/restrict/typedef type instead of leaving it set to eResolveStateUnresolved.
llvm-svn: 239752
Eric Christopher [Mon, 15 Jun 2015 20:16:53 +0000 (20:16 +0000)]
Remove duplicate conditional in if-stmt.
Fixes PR23839.
llvm-svn: 239751
Richard Smith [Mon, 15 Jun 2015 20:15:48 +0000 (20:15 +0000)]
[modules] Better support for redefinitions of an entity from the same module.
Support this across module save/reload and extend the 'missing import'
diagnostics with a list of providing modules.
llvm-svn: 239750
Rafael Espindola [Mon, 15 Jun 2015 20:08:17 +0000 (20:08 +0000)]
Cleanup the constructor of BitcodeReader. NFC.
Use the same argument names as the members.
Use default member initializes.
Extracted from a patch by Karl Schimpf.
llvm-svn: 239749
Sanjoy Das [Mon, 15 Jun 2015 20:05:38 +0000 (20:05 +0000)]
Add "REQUIRES: asserts" to test case that uses -debug-only
llvm-svn: 239748
Sanjoy Das [Mon, 15 Jun 2015 19:38:15 +0000 (19:38 +0000)]
Unbreak docs build from r239740.
Add FaultMaps.rst to toctree.
llvm-svn: 239747
Sanjoy Das [Mon, 15 Jun 2015 19:29:44 +0000 (19:29 +0000)]
Unbreak the build from r239740.
Do not re-use an enum name as a field name. Some bots don't like this.
llvm-svn: 239746
Rui Ueyama [Mon, 15 Jun 2015 19:06:53 +0000 (19:06 +0000)]
COFF: Simplify SymbolBody::compare(SymbolBody *Other).
We are currently handling all combinations of SymbolBody types directly.
This patch is to flip this and Other if Other->kind() < this->kind()
to reduce number of combinations. No functionality change intended.
llvm-svn: 239745
Colin LeMahieu [Mon, 15 Jun 2015 19:05:35 +0000 (19:05 +0000)]
[Hexagon] Moving pass declarations out of header and in to implementation files. Removing unused function getSubtargetInfo from HexagonMCCodeEmitter.cpp Removing deletion of copy construction and assignment operator since parent already deletes it.
llvm-svn: 239744
Sanjoy Das [Mon, 15 Jun 2015 18:44:27 +0000 (18:44 +0000)]
[CodeGen] Add a pass to fold null checks into nearby memory operations.
Summary:
This change adds an "ImplicitNullChecks" target dependent pass. This
pass folds null checks into memory operation using the FAULTING_LOAD
pseudo-op introduced in previous patches.
Depends on D10197
Depends on D10199
Depends on D10200
Reviewers: reames, rnk, pgavlin, JosephTremoulet, atrick
Reviewed By: atrick
Subscribers: ab, JosephTremoulet, llvm-commits
Differential Revision: http://reviews.llvm.org/D10201
llvm-svn: 239743
Sanjoy Das [Mon, 15 Jun 2015 18:44:21 +0000 (18:44 +0000)]
[TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.
Summary:
NFC: no one uses AnalyzeBranchPredicate yet.
Add TargetInstrInfo::AnalyzeBranchPredicate and implement for x86. A
later change adding support for page-fault based implicit null checks
depends on this.
Reviewers: reames, ab, atrick
Reviewed By: atrick
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10200
llvm-svn: 239742
Sanjoy Das [Mon, 15 Jun 2015 18:44:14 +0000 (18:44 +0000)]
[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.
Summary:
TargetInstrInfo::getLdStBaseRegImmOfs to
TargetInstrInfo::getMemOpBaseRegImmOfs and implement for x86. The
implementation only handles a few easy cases now and will be made more
sophisticated in the future.
This is NFCI: the only user of `getLdStBaseRegImmOfs` (now
`getmemOpBaseRegImmOfs`) is `LoadClusterMotion` and `LoadClusterMotion`
is disabled for x86.
Reviewers: reames, ab, MatzeB, atrick
Reviewed By: MatzeB, atrick
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10199
llvm-svn: 239741
Sanjoy Das [Mon, 15 Jun 2015 18:44:08 +0000 (18:44 +0000)]
[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.
Summary:
This instruction encodes a loading operation that may fault, and a label
to branch to if the load page-faults. The locations of potentially
faulting loads and their "handler" destinations are recorded in a
FaultMap section, meant to be consumed by LLVM's clients.
Nothing generates FAULTING_LOAD_OP instructions yet, but they will be
used in a future change.
The documentation (FaultMaps.rst) needs improvement and I will update
this diff with a more expanded version shortly.
Depends on D10196
Reviewers: rnk, reames, AndyAyers, ab, atrick, pgavlin
Reviewed By: atrick, pgavlin
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10197
llvm-svn: 239740
Sanjoy Das [Mon, 15 Jun 2015 18:44:01 +0000 (18:44 +0000)]
[NFC] Extract X86MCInstLower::LowerMachineOperand.
Summary: Refactoring-only change that will be used later.
Reviewers: reames, atrick
Reviewed By: atrick
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10196
llvm-svn: 239739
Rui Ueyama [Mon, 15 Jun 2015 18:03:47 +0000 (18:03 +0000)]
COFF: Fix .reloc section attributes.
llvm-svn: 239738
Luke Cheeseman [Mon, 15 Jun 2015 17:51:01 +0000 (17:51 +0000)]
This patch implements clang support for the ACLE special register intrinsics
in section 10.1, __arm_{w,r}sr{,p,64}.
This includes arm_acle.h definitions with builtins and codegen to support
these, the intrinsics are implemented by generating read/write_register calls
which get appropriately lowered in the backend based on the register string
provided. SemaChecking is also implemented to fault invalid parameters.
Differential Revision: http://reviews.llvm.org/D9697
llvm-svn: 239737
Yaron Keren [Mon, 15 Jun 2015 17:03:35 +0000 (17:03 +0000)]
De-duplicate common expression, NFC.
llvm-svn: 239736
Rui Ueyama [Mon, 15 Jun 2015 16:25:11 +0000 (16:25 +0000)]
COFF: Update README.
llvm-svn: 239734
Yaron Keren [Mon, 15 Jun 2015 16:20:16 +0000 (16:20 +0000)]
Rangify several for loops, NFC.
llvm-svn: 239733
Evgeny Astigeevich [Mon, 15 Jun 2015 15:48:44 +0000 (15:48 +0000)]
On behalf of Alexandros Lamprineas:
LLVM targeting aarch64 doesn't correctly produce aligned accesses for non-aligned
data at -O0/fast-isel (-mno-unaligned-access).
The root cause seems to be in fast-isel not producing unaligned access correctly
for -mno-unaligned-access.
The patch just aborts fast-isel for loads and stores when -mno-unaligned-access is
present.
The regression test is updated to check this new test case (-mno-unaligned-access
together with fast-isel).
Differential Revision: http://reviews.llvm.org/D10360
llvm-svn: 239732
Benjamin Kramer [Mon, 15 Jun 2015 15:42:26 +0000 (15:42 +0000)]
[LinkerTest] Use LLVMDisposeMessage to free error string.
LLVMDisposeMessage is just a thing wrapper around free at the moment, but it's
the proper API to use here.
llvm-svn: 239731
Daniel Jasper [Mon, 15 Jun 2015 15:25:11 +0000 (15:25 +0000)]
clang-format: NFC. Move testing of selective formatting to a separate file.
This is a first step for splitting the huge FormatTest.cpp into separate
files to make it easier to find specific tests.
llvm-svn: 239730