Reid Kleckner [Mon, 2 Mar 2015 22:42:58 +0000 (22:42 +0000)]
Remove shell requirements from tests that use 'cd'
Modules and Tooling tests in particular tend to want to change the cwd,
so we were missing test coverage in this area on Windows. It should now
be easier to write such portable tests.
Sanjoy Das [Mon, 2 Mar 2015 21:47:47 +0000 (21:47 +0000)]
Fix test case.
r230921 broke backend-optimization-failure.cpp: after
r230921, LLVM no longer emits an expression to compute 'Length - 1'
and this perturbs LoopSimplify enough to emit the warning on line 10
instead of line 9. This is a review request to fix the test case once
I re-land r230921.
Matthias Braun [Mon, 2 Mar 2015 20:44:09 +0000 (20:44 +0000)]
Improve robustness of dependency-generation-crash.c test.
The test wants to provoke a failure when opening the output file.
Using chmod 0 on the output file does not work reliably on all
filesystems or when running the test as root.
Change the test to use a nonexistant directory instead.
Add -frtti and -fexceptions to tests that assume these are on.
Summary:
We now have targets that don't enable rtti/exceptions by default, and the
ASTMatchers tests are assuming that these features are on (e.g: They use
dynamic_cast or try).
Benjamin Kramer [Mon, 2 Mar 2015 16:09:24 +0000 (16:09 +0000)]
CodeGen: Fix passing of classes with only one AVX vector member in AVX registers
isSingleElementStruct was a bit too tight in its definition of struct
so we got a mismatch between classify() and the actual code generation.
To make matters worse the code in GetByteVectorType still defaulted to
<2 x double> if it encountered a type it didn't know, making this a
silent miscompilation (PR22753).
Completely remove the "preferred type" stuff from GetByteVectorType and
make it fail an assertion if someone tries to use it with a type not
suitable for a vector register.
Richard Smith [Sat, 28 Feb 2015 03:09:52 +0000 (03:09 +0000)]
Give better diagnostics when -fmodule-file= finds a bad file: if the file is
found indirectly, explain how we got there, and distinguish between 'file not
found' and 'file found but invalid'.
Richard Smith [Sat, 28 Feb 2015 01:01:56 +0000 (01:01 +0000)]
Rework our handling of key functions. We used to track a complete list of all
dynamic classes in the translation unit and check whether each one's key
function is defined when we got to the end of the TU (and when we got to the
end of each module). This is really terrible for modules performance, since it
causes unnecessary deserialization of every dynamic class in every compilation.
We now use a much simpler (and, in a modules build, vastly more efficient)
system: when we see an out-of-line definition of a virtual function, we check
whether that function was in fact its class's key function. (If so, we need to
emit the vtable.)
DebugInfo: hoist definition into global context when needed
When generating debug info for a static inline member which is initialized for
the DLLExport storage class, hoist the definition into a non-composite type
context. Otherwise, we would trigger an assertion when generating the DIE for
the associated global value as the debug context has a type association. This
addresses PR22669.
Thanks to David Blakie for help in coming up with a solution to this!
Richard Smith [Fri, 27 Feb 2015 23:05:10 +0000 (23:05 +0000)]
[modules] When writing out a list of specializations for a template, if we have
undeserialized specializations (because we merged an imported declaration of
the same template since we last added one), don't bother reading in the
specializations themselves just so we can write out their IDs again.
Daniel Jasper [Fri, 27 Feb 2015 08:16:32 +0000 (08:16 +0000)]
Revert r230717 (and subsequent r230720).
The tests keeps failing on build bots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2355/testReport/junit/Clang/CodeGen/exceptions_seh_leave_c/
Alexey Bataev [Fri, 27 Feb 2015 06:33:30 +0000 (06:33 +0000)]
[OPENMP] Codegen for "#pragma omp atomic write"
For global reg lvalue - use regular store through global register.
For simple lvalue - use simple atomic store.
For bitfields, vector element, extended vector elements - the original value of the whole storage (for vector elements) or of some aligned value (for bitfields) is atomically read, the part of this value for the given lvalue is modified and then use atomic compare-and-exchange operation to try to atomically write modified value (if it was not modified).
Also, changes in this patch fix the bug for '#pragma omp atomic read' applied to extended vector elements.
Differential Revision: http://reviews.llvm.org/D7369
Richard Smith [Fri, 27 Feb 2015 01:57:00 +0000 (01:57 +0000)]
[modules] For an inheriting constructor, the inherited constructor is stored in
a map keyed off the canonical declaration. Don't try to set it if we're loading
some non-canonical merged declaration.
Richard Smith [Fri, 27 Feb 2015 00:25:58 +0000 (00:25 +0000)]
[modules] When loading in multiple canonical definitions of a template,
accumulate the set of specializations rather than overwriting one list
with another.
Nico Weber [Thu, 26 Feb 2015 22:34:33 +0000 (22:34 +0000)]
Don't crash on leaving nested __finally blocks through an EH edge.
The __finally emission block tries to be clever by removing unused continuation
edges if there's an unconditional jump out of the __finally block. With
exception edges, the EH continuation edge isn't always unused though and we'd
crash in a few places.
Just don't be clever. That makes the IR for __finally blocks a bit longer in
some cases (hence small and behavior-preserving changes to existing tests), but
it makes no difference in general and it fixes the last crash from PR22553.
Reid Kleckner [Thu, 26 Feb 2015 19:43:46 +0000 (19:43 +0000)]
Win64: Silently ignore __stdcall, __fastcall, and __thiscall
MSVC doesn't warn on this. Users are expected to apply the WINAPI macro
to functions passed by pointer to the Win32 API, and this macro expands
to __stdcall. This means we end up with a lot of useless noisy warnings
about ignored calling conventions when compiling code with clang for
Win64.
Evgeniy Stepanov [Thu, 26 Feb 2015 15:59:30 +0000 (15:59 +0000)]
[msan] Change track-origins default mode from 1 to 2.
Change -fsanitize-memory-track-origins to be equivalent to
-fsanitize-memory-track-origins=2.
Track-origins=2 provides a lot more detailed reports at the cost of
some additional slowdown (ranging from none to, sometimes, 3x; ~3% average on
SPEC2006).
Alexey Bataev [Thu, 26 Feb 2015 10:27:34 +0000 (10:27 +0000)]
[OPENMP] Fixed codegen for directives without function outlining.
Fixed crash on codegen for directives like 'omp for', 'omp single' etc. inside of the 'omp parallel', 'omp task' etc. regions.
Simon Atanasyan [Thu, 26 Feb 2015 04:45:57 +0000 (04:45 +0000)]
[Mips] Handle -mips32r[3|5] / -mips64r[3|5] options while selecting lib/headers paths
There is no supported toolchain which provides headers / libs / object
files specific to the mips32r[3|5] and mips64r[3|5] ISA. So select "r2"
specific folders when they are available.
CGDebugInfo: Use DIImportedEntity default constructor, NFC
Use the newly minted `DIImportedEntity` default constructor (r230609)
rather than explicitly specifying `nullptr`. The latter will become
ambiguous when the new debug info hierarchy is committed, since we'll
have both of the following:
Richard Trieu [Thu, 26 Feb 2015 02:40:48 +0000 (02:40 +0000)]
Update assumption in template diffing about integer template arguments.
Fix for PR22017. Integer template arguments are automatically bit extended to
the size of the integer type. In template diffing, evaluated expressions were
not having their results extending, leading to comparing two APSInt's with
different widths. Apply the proper bit extending when evaluating template
arguments. This mainly affected bool template arguments.
The final dependency edge here is probably removable: AnalyzerOptions (and
Analyses.def) should probably live in Basic rather than StaticAnalyzer/Core.
David Majnemer [Thu, 26 Feb 2015 00:57:33 +0000 (00:57 +0000)]
Sema: __assume with side effects shouldn't result in invalid AST nodes
We'd diagnose an __assume expression which contained a function call.
This would result in us wrongly returning ExprError, causing mysterious
failures later on.
Reid Kleckner [Thu, 26 Feb 2015 00:17:25 +0000 (00:17 +0000)]
Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.
If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.
Larisse Voufo [Wed, 25 Feb 2015 23:48:43 +0000 (23:48 +0000)]
Improvement on sized deallocation from r230160:
Do not declare sized deallocation functions dependently on whether it is found in global scope. Instead, enforce the branching in emitted code by (1) declaring the functions extern_weak and (2) emitting sized delete expressions as a branching between both forms delete.
Richard Smith [Wed, 25 Feb 2015 22:20:13 +0000 (22:20 +0000)]
[modules] Even if we already have a definition of a class, loading in another
one can give us more lookup results (due to implicit special members). Be sure
to complete the redecl chain for every kind of DeclContext before performing a
lookup into it, rather than only doing so for NamespaceDecls.
Ben Langmuir [Wed, 25 Feb 2015 20:09:06 +0000 (20:09 +0000)]
Allow (Object *)kMyGlobalCFObj casts without bridging
Previously we allowed these casts only for constants declared in system
headers, which we assume are retain/release-neutral. Now also allow them
for constants in user headers, treating them as +0. Practically, this
means that we will now allow:
id x = (id)kMyGlobalConst;
But unlike with system headers we cannot mix them with +1 values:
id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error
id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK
Reid Kleckner [Wed, 25 Feb 2015 19:17:50 +0000 (19:17 +0000)]
clang-cl: Ignore /Fd silently
While it's true that we don't create the PDB as requested on the command
line, this is a well-documented limitation. Warning about it doesn't
help people using legacy build systems with clang-cl, and it makes the
clang-cl self-host very noisy.
Reid Kleckner [Wed, 25 Feb 2015 19:17:45 +0000 (19:17 +0000)]
Reland r230446, "MS ABI: Try to respect external AST source record layouts"
It broke test/PCH/headersearch.cpp because it was using -Wpadding, which
only works for Itanium layout. Before this commit, we would use Itanium
record layout when using PCH, which is crazy. Now that the test uses an
explicit Itanium triple, we can reland.
Reid Kleckner [Wed, 25 Feb 2015 19:04:51 +0000 (19:04 +0000)]
Use Itanium triple in test using -Wpadding
-Wpadding is not implemented in the Microsoft record layout builder.
This test only passes on Windows because PCH forces us to use the
Itanium record layout builder. I'm about to fix that, so change the
test to not rely on that ridiculous behavior.
Nico Weber [Wed, 25 Feb 2015 16:25:00 +0000 (16:25 +0000)]
Reland r230460 with a test fix for -Asserts builds.
Original CL description:
Produce less broken basic block sequences for __finally blocks.
The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.
The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block. However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow). That's not correct,
as that block can (and generally does) already ends in a jump. Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.
The original commit failed to handle "shift assign" (<<=), which
broke the test mentioned in r228406. This is now fixed and the
test added to the lit tests under SemaOpenCL.
*** Original commit message from r228382 ***
OpenCL: handle shift operator with vector operands
Introduce a number of checks:
1. If LHS is a scalar, then RHS cannot be a vector.
2. Operands must be of integer type.
3. If both are vectors, then the number of elements must match.
Relax the requirement for "usual arithmetic conversions":
When LHS is a vector, a scalar RHS can simply be expanded into a
vector; OpenCL does not require that its rank be lower than the LHS.
For example, the following code is not an error even if the implicit
type of the constant literal is "int".
char2 foo(char2 v) { return v << 1; }
Consolidate existing tests under CodeGenOpenCL, and add more tests
under SemaOpenCL.
Nico Weber [Wed, 25 Feb 2015 04:05:18 +0000 (04:05 +0000)]
Produce less broken basic block sequences for __finally blocks.
The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.
The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block. However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow). That's not correct,
as that block can (and generally does) already ends in a jump. Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.