platform/upstream/llvm.git
9 years ago[CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz.
Andrea Di Biagio [Sun, 28 Dec 2014 11:07:35 +0000 (11:07 +0000)]
[CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz.

If the control flow is modelling an if-statement where the only instruction in
the 'then' basic block (excluding the terminator) is a call to cttz/ctlz,
CodeGenPrepare can try to speculate the cttz/ctlz call and simplify the control
flow graph.

Example:
\code
entry:
  %cmp = icmp eq i64 %val, 0
  br i1 %cmp, label %end.bb, label %then.bb

then.bb:
  %c = tail call i64 @llvm.cttz.i64(i64 %val, i1 true)
  br label %end.bb

end.bb:
  %cond = phi i64 [ %c, %then.bb ], [ 64, %entry]
\code

In this example, basic block %then.bb is taken if value %val is not zero.
Also, the phi node in %end.bb would propagate the size-of in bits of %val
only if %val is equal to zero.

With this patch, CodeGenPrepare will try to hoist the call to cttz from %then.bb
into basic block %entry only if cttz is cheap to speculate for the target.

Added two new hooks in TargetLowering.h to let targets customize the behavior
(i.e. decide whether it is cheap or not to speculate calls to cttz/ctlz). The
two new methods are 'isCheapToSpeculateCtlz' and 'isCheapToSpeculateCttz'.
By default, both methods return 'false'.
On X86, method 'isCheapToSpeculateCtlz' returns true only if the target has
LZCNT. Method 'isCheapToSpeculateCttz' only returns true if the target has BMI.

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

llvm-svn: 224899

9 years agoSema: Don't crash when an inject class name has a nested redefinition
David Majnemer [Sun, 28 Dec 2014 09:18:54 +0000 (09:18 +0000)]
Sema: Don't crash when an inject class name has a nested redefinition

We expected the type of a TagDecl to be a TagType, not an
InjectedClassNameType.  Introduced a helper method, Type::getAsTagDecl,
to abstract away the difference; redefine Type::getAsCXXRecordDecl to be
in terms of it.

llvm-svn: 224898

9 years agoScalarizer for masked load and store intrinsics.
Elena Demikhovsky [Sun, 28 Dec 2014 08:54:45 +0000 (08:54 +0000)]
Scalarizer for masked load and store intrinsics.

Masked vector intrinsics are a part of common LLVM IR, but they are really supported on AVX2 and AVX-512 targets. I added a code that translates masked intrinsic for all other targets. The masked vector intrinsic is converted to a chain of scalar operations inside conditional basic blocks.

http://reviews.llvm.org/D6436

llvm-svn: 224897

9 years agoLex: Don't let annotation tokens get into macro expansion
David Majnemer [Sun, 28 Dec 2014 07:42:49 +0000 (07:42 +0000)]
Lex: Don't let annotation tokens get into macro expansion

We'd let annotation tokens from '#pragma pack' and the like get inside a
function-like macro.  This would lead to terror and mayhem; stop the
madness early.

This fixes PR22037.

llvm-svn: 224896

9 years agoFix markup from r224894.
Nico Weber [Sun, 28 Dec 2014 02:12:59 +0000 (02:12 +0000)]
Fix markup from r224894.

llvm-svn: 224895

9 years agoAdd stub sections about Parse, Sema, CodeGen to the internals manual.
Nico Weber [Sun, 28 Dec 2014 02:07:26 +0000 (02:07 +0000)]
Add stub sections about Parse, Sema, CodeGen to the internals manual.

I'd be interested if the paragraph on Parse not knowing much about AST is
something folks agree with.  I think this used to be true after rjmccall removed
the Action interface in r112244 and I believe it's still true, but I'm not sure.
(For example, ParseOpenMP.cpp does include AST/StmtOpenMP.h.  Other than that,
Parse not using AST nodes much seems to be still true, though.)

llvm-svn: 224894

9 years agoRemove unneeded include of DeclCXX.h from libParse.
Nico Weber [Sun, 28 Dec 2014 01:52:28 +0000 (01:52 +0000)]
Remove unneeded include of DeclCXX.h from libParse.

llvm-svn: 224893

9 years agoObjective-C: Serialize "more than one decl" state of ObjCMethodList.
Nico Weber [Sat, 27 Dec 2014 22:14:15 +0000 (22:14 +0000)]
Objective-C: Serialize "more than one decl" state of ObjCMethodList.

This fixes PR21587, what r221933 fixed for regular programs is now also
fixed for decls coming from PCH files.

Use another bit from the count/bits uint16_t for storing the "more than one
decl" bit.  This reduces the number of bits for the count from 14 to 13.
The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits
should still be plenty.  Since this changes the meaning of a serialized bit
pattern, also increase clang::serialization::VERSION_MAJOR.

Storing the "more than one decl" state of only the first overload isn't quite
correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at
the state of the first overload so it's good enough for now.

llvm-svn: 224892

9 years ago[x86] Prevent instruction selection of AVX512 cmp.ps/pd/ss/sd intrinsics with illegal...
Craig Topper [Sat, 27 Dec 2014 20:08:45 +0000 (20:08 +0000)]
[x86] Prevent instruction selection of AVX512 cmp.ps/pd/ss/sd intrinsics with illegal immediates. Correctly this time. I did the wrong patterns the first time.

llvm-svn: 224891

9 years agoPowerPC: CTR shouldn't fire if a TLS call is in the loop
David Majnemer [Sat, 27 Dec 2014 19:45:38 +0000 (19:45 +0000)]
PowerPC: CTR shouldn't fire if a TLS call is in the loop

Determining the address of a TLS variable results in a function call in
certain TLS models.  This means that a simple ICmpInst might actually
result in invalidating the CTR register.

In such cases, do not attempt to rely on the CTR register for loop
optimization purposes.

This fixes PR22034.

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

llvm-svn: 224890

9 years agoFixing another -Wunused-variable warning, this time in release builds without asserts...
Aaron Ballman [Sat, 27 Dec 2014 19:17:53 +0000 (19:17 +0000)]
Fixing another -Wunused-variable warning, this time in release builds without asserts. NFC.

llvm-svn: 224889

9 years agoRemoving a variable that is set but never used, to silence a -Wunused-but-set-variabl...
Aaron Ballman [Sat, 27 Dec 2014 19:01:19 +0000 (19:01 +0000)]
Removing a variable that is set but never used, to silence a -Wunused-but-set-variable warning; NFC.

llvm-svn: 224888

9 years ago[x86] Prevent instruction selection of AVX512 cmp.ps/pd/ss/sd intrinsics with illegal...
Craig Topper [Sat, 27 Dec 2014 18:51:06 +0000 (18:51 +0000)]
[x86] Prevent instruction selection of AVX512 cmp.ps/pd/ss/sd intrinsics with illegal immediates. Forgot to do this when I did SSE/SSE2/AVX/AVX2.

llvm-svn: 224887

9 years ago[x86] Assert on invalid immediates in the instruction printer for cmp.ps/pd/ss/sd...
Craig Topper [Sat, 27 Dec 2014 18:11:00 +0000 (18:11 +0000)]
[x86] Assert on invalid immediates in the instruction printer for cmp.ps/pd/ss/sd instead of truncating the immediate. The assembly parser and instruction selection shouldn't generate invalid immediates.

llvm-svn: 224886

9 years ago[x86] Prevent llvm.x86.cmp.ps/pd/ss/sd from being selected with bad immediates. The...
Craig Topper [Sat, 27 Dec 2014 18:10:56 +0000 (18:10 +0000)]
[x86] Prevent llvm.x86.cmp.ps/pd/ss/sd from being selected with bad immediates. The frontend now checks this when the builtin is used. This will allow the instruction printer to not have to deal with invalid immediates on these instructions.

llvm-svn: 224885

9 years ago[FastIsel][X86] Fix invalid register replacement for bool args
Keno Fischer [Sat, 27 Dec 2014 13:10:15 +0000 (13:10 +0000)]
[FastIsel][X86] Fix invalid register replacement for bool args

Summary:
Consider the following IR:

  %3 = load i8* undef
  %4 = trunc i8 %3 to i1
  %5 = call %jl_value_t.0* @foo(..., i1 %4, ...)
  ret %jl_value_t.0* %5

Bools (that are the result of direct truncs) are lowered as whatever
the argument to the trunc was and a "and 1", causing the part of the
MBB responsible for this argument to look something like this:

  %vreg8<def,tied1> = AND8ri %vreg7<kill,tied0>, 1, %EFLAGS<imp-def>; GR8:%vreg8,%vreg7

Later, when the load is lowered, it will insert

  %vreg15<def> = MOV8rm %vreg14, 1, %noreg, 0, %noreg; mem:LD1[undef] GR8:%vreg15 GR64:%vreg14

but remember to (at the end of isel) replace vreg7 by vreg15. Now for
the bug. In fast isel lowering, we mistakenly mark vreg8 as the result
of the load instead of the trunc. This adds a fixup to have
vreg8 replaced by whatever the result of the load is as well, so
we end up with

  %vreg15<def,tied1> = AND8ri %vreg15<kill,tied0>, 1, %EFLAGS<imp-def>; GR8:%vreg15

which is an SSA violation and causes problems later down the road.

This fixes PR21557.

Test Plan: Test test case from PR21557 is added to the test suite.

Reviewers: ributzka

Reviewed By: ributzka

Subscribers: llvm-commits

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

llvm-svn: 224884

9 years ago[x86] Also add the missing type casts on the returns in the sha
Chandler Carruth [Sat, 27 Dec 2014 11:50:51 +0000 (11:50 +0000)]
[x86] Also add the missing type casts on the returns in the sha
intrinsic header file. Along with r224822, this should restore the build
bots to passing.

llvm-svn: 224883

9 years ago[x86] Add missing typecast to __v4si to sha intrinsic header file.
Craig Topper [Sat, 27 Dec 2014 07:19:25 +0000 (07:19 +0000)]
[x86] Add missing typecast to __v4si to sha intrinsic header file.

llvm-svn: 224882

9 years agoObjective-C: Tweak unavailability warning.
Nico Weber [Sat, 27 Dec 2014 07:09:37 +0000 (07:09 +0000)]
Objective-C: Tweak unavailability warning.

Don't warn when a selector has an unavailable and an available variant,
and the first also has an implementation.

llvm-svn: 224881

9 years ago[x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.
Craig Topper [Sat, 27 Dec 2014 07:00:08 +0000 (07:00 +0000)]
[x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.

llvm-svn: 224880

9 years ago[x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse intrinsic...
Craig Topper [Sat, 27 Dec 2014 06:59:57 +0000 (06:59 +0000)]
[x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse intrinsic files.

This still lower to the same intrinsics as before.

This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc.

llvm-svn: 224879

9 years agoAdd more feature flags to the x86 instrinsic test.
Craig Topper [Sat, 27 Dec 2014 06:59:44 +0000 (06:59 +0000)]
Add more feature flags to the x86 instrinsic test.

llvm-svn: 224878

9 years agoFix formatting. NFC.
Craig Topper [Sat, 27 Dec 2014 06:59:37 +0000 (06:59 +0000)]
Fix formatting. NFC.

llvm-svn: 224877

9 years agoAddress review feedback on r221933.
Nico Weber [Sat, 27 Dec 2014 03:58:08 +0000 (03:58 +0000)]
Address review feedback on r221933.

Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in
the low bit of the ObjCMethodDecl pointer, using a PointerIntPair.

Most of this patch is replacing ".Method" with ".getMethod()".

No intended behavior change.

llvm-svn: 224876

9 years agoMake the test from r224873 actually pass.
Nico Weber [Sat, 27 Dec 2014 03:38:18 +0000 (03:38 +0000)]
Make the test from r224873 actually pass.

The behavior looks incorrect to me, but the test is supposed to document
current behavior for now.

llvm-svn: 224875

9 years agoMark __builtin_ia32_cmppd256 and __builtin_ia32_cmpps256 as taking an ICE for the...
Craig Topper [Sat, 27 Dec 2014 01:20:16 +0000 (01:20 +0000)]
Mark __builtin_ia32_cmppd256 and __builtin_ia32_cmpps256 as taking an ICE for the constant parameter.

llvm-svn: 224874

9 years agoAdd more test coverage for the Objective-C deprected selector warning.
Nico Weber [Sat, 27 Dec 2014 01:05:55 +0000 (01:05 +0000)]
Add more test coverage for the Objective-C deprected selector warning.

I broke this case in a local patch I'm writing, and there was no test to stop
me.  Now there is.

llvm-svn: 224873

9 years agoConvert test to llvm-readobj. NFC.
Rafael Espindola [Fri, 26 Dec 2014 22:47:39 +0000 (22:47 +0000)]
Convert test to llvm-readobj. NFC.

llvm-svn: 224872

9 years ago[Hexagon] Adding auto-incrementing loads with and without byte reversal.
Colin LeMahieu [Fri, 26 Dec 2014 21:09:25 +0000 (21:09 +0000)]
[Hexagon] Adding auto-incrementing loads with and without byte reversal.

llvm-svn: 224871

9 years ago[Hexagon] Adding locked loads.
Colin LeMahieu [Fri, 26 Dec 2014 20:42:27 +0000 (20:42 +0000)]
[Hexagon] Adding locked loads.

llvm-svn: 224870

9 years ago[Hexagon] Adding deallocframe and circular addressing loads.
Colin LeMahieu [Fri, 26 Dec 2014 20:30:58 +0000 (20:30 +0000)]
[Hexagon] Adding deallocframe and circular addressing loads.

llvm-svn: 224869

9 years ago[Hexagon] Adding remaining post-increment instruction variants. Removing unused...
Colin LeMahieu [Fri, 26 Dec 2014 19:31:46 +0000 (19:31 +0000)]
[Hexagon] Adding remaining post-increment instruction variants.  Removing unused classes.

llvm-svn: 224868

9 years ago[Hexagon] Adding post-increment unsigned byte loads.
Colin LeMahieu [Fri, 26 Dec 2014 19:12:11 +0000 (19:12 +0000)]
[Hexagon] Adding post-increment unsigned byte loads.

llvm-svn: 224867

9 years ago[Hexagon] Adding post-increment signed byte loads with tests.
Colin LeMahieu [Fri, 26 Dec 2014 18:57:13 +0000 (18:57 +0000)]
[Hexagon] Adding post-increment signed byte loads with tests.

llvm-svn: 224866

9 years agoAdjust the rest of the tests due to r224849.
David Majnemer [Fri, 26 Dec 2014 18:45:57 +0000 (18:45 +0000)]
Adjust the rest of the tests due to r224849.

llvm-svn: 224865

9 years agoUse llvm-readobj. NFC.
Rafael Espindola [Fri, 26 Dec 2014 18:22:05 +0000 (18:22 +0000)]
Use llvm-readobj. NFC.

llvm-svn: 224864

9 years agoEscape ? to silence GCC warning about trigraphs.
Daniel Jasper [Fri, 26 Dec 2014 18:21:34 +0000 (18:21 +0000)]
Escape ? to silence GCC warning about trigraphs.

llvm-svn: 224863

9 years ago[X86] Add the debug registers DR8-DR15 so we can assemble and disassemble references...
Craig Topper [Fri, 26 Dec 2014 18:20:05 +0000 (18:20 +0000)]
[X86] Add the debug registers DR8-DR15 so we can assemble and disassemble references to them.

llvm-svn: 224862

9 years ago[X86] Don't fail disassembly if REX.R/REX.B is used on an MMX register. Similar fix...
Craig Topper [Fri, 26 Dec 2014 18:19:44 +0000 (18:19 +0000)]
[X86] Don't fail disassembly if REX.R/REX.B is used on an MMX register. Similar fix to not fail to disassembler CR9-CR15 references.

llvm-svn: 224861

9 years agoBand-aid fix for PR22032: don't emit DWARF debug info if AddressSanitizer is enabled...
Timur Iskhodzhanov [Fri, 26 Dec 2014 17:00:51 +0000 (17:00 +0000)]
Band-aid fix for PR22032: don't emit DWARF debug info if AddressSanitizer is enabled on Windows

llvm-svn: 224860

9 years agoNo need to run llvm-as. NFC.
Rafael Espindola [Fri, 26 Dec 2014 16:42:47 +0000 (16:42 +0000)]
No need to run llvm-as. NFC.

llvm-svn: 224859

9 years ago[sanitizer] Treat \r, \n, \t as flag separators.
Evgeniy Stepanov [Fri, 26 Dec 2014 16:09:15 +0000 (16:09 +0000)]
[sanitizer] Treat \r, \n, \t as flag separators.

llvm-svn: 224858

9 years ago[asan] Fix possibly uninitialized coverage flag.
Evgeniy Stepanov [Fri, 26 Dec 2014 16:07:33 +0000 (16:07 +0000)]
[asan] Fix possibly uninitialized coverage flag.

llvm-svn: 224857

9 years ago[ASan/Win] Add basic support for MemoryRangeIsAvailable and DumpProcessMap to make...
Timur Iskhodzhanov [Fri, 26 Dec 2014 14:28:32 +0000 (14:28 +0000)]
[ASan/Win] Add basic support for MemoryRangeIsAvailable and DumpProcessMap to make it easier to debug startup shadow mapping failures

llvm-svn: 224856

9 years ago[asan] Bump coverage size limit on 32-bit platforms.
Evgeniy Stepanov [Fri, 26 Dec 2014 13:54:11 +0000 (13:54 +0000)]
[asan] Bump coverage size limit on 32-bit platforms.

This increases the limit from 4M locations to 16M, reserving
64Mb virtual memory. Chrome has >5M unique coverage locations with coverage=3.

llvm-svn: 224855

9 years ago[asan] Extend coverage test.
Evgeniy Stepanov [Fri, 26 Dec 2014 12:51:31 +0000 (12:51 +0000)]
[asan] Extend coverage test.

llvm-svn: 224854

9 years ago[asan] Allow enabling coverage at activation.
Evgeniy Stepanov [Fri, 26 Dec 2014 12:32:32 +0000 (12:32 +0000)]
[asan] Allow enabling coverage at activation.

This is a re-commit of r224838 + r224839, previously reverted in r224850.
Test failures were likely (still can not reproduce) caused by two lit tests
using the same name for an intermediate build target.

llvm-svn: 224853

9 years ago[ASan/Win] Suppress error messaging when Abort() is called
Timur Iskhodzhanov [Fri, 26 Dec 2014 12:25:54 +0000 (12:25 +0000)]
[ASan/Win] Suppress error messaging when Abort() is called
This will prevent ASan bots from hanging / timing out

llvm-svn: 224852

9 years agoUpdate tests due to r224849
David Majnemer [Fri, 26 Dec 2014 10:29:40 +0000 (10:29 +0000)]
Update tests due to r224849

Inferring nuw caused some clang tests to change their output.

llvm-svn: 224851

9 years agoRevert r224838, r224839.
Evgeniy Stepanov [Fri, 26 Dec 2014 10:19:56 +0000 (10:19 +0000)]
Revert r224838, r224839.

Flaky failures on the build bots.

llvm-svn: 224850

9 years agoInstCombine: Infer nuw for multiplies
David Majnemer [Fri, 26 Dec 2014 09:50:35 +0000 (09:50 +0000)]
InstCombine: Infer nuw for multiplies

A multiply cannot unsigned wrap if there are bitwidth, or more, leading
zero bits between the two operands.

llvm-svn: 224849

9 years agoValueTracking: Small cleanup in ComputeNumSignBits
David Majnemer [Fri, 26 Dec 2014 09:20:17 +0000 (09:20 +0000)]
ValueTracking: Small cleanup in ComputeNumSignBits

Constant contains the isAllOnesValue and isNullValue predicates, not
ConstantInt.

llvm-svn: 224848

9 years agoInstCombe: Infer nsw for multiplies
David Majnemer [Fri, 26 Dec 2014 09:10:14 +0000 (09:10 +0000)]
InstCombe: Infer nsw for multiplies

We already utilize this logic for reducing overflow intrinsics, it makes
sense to reuse it for normal multiplies as well.

llvm-svn: 224847

9 years agoTeach disassembler to handle illegal immediates on (v)cmpps/pd/ss/sd instructions...
Craig Topper [Fri, 26 Dec 2014 06:36:28 +0000 (06:36 +0000)]
Teach disassembler to handle illegal immediates on (v)cmpps/pd/ss/sd instructions. Instead of rejecting we'll just generate the _alt forms that don't try to alter the mnemonic. While I'm here, merge some common code in the Instruction printers for the condition code replacement and fix the mask on SSE to be 3-bits instead of 4.

llvm-svn: 224846

9 years agoUse MCPhysReg for table of register encodings.
Craig Topper [Fri, 26 Dec 2014 06:36:23 +0000 (06:36 +0000)]
Use MCPhysReg for table of register encodings.

llvm-svn: 224845

9 years agoSema: Qualify getPrintable's Expr argument
David Majnemer [Fri, 26 Dec 2014 06:06:56 +0000 (06:06 +0000)]
Sema: Qualify getPrintable's Expr argument

getPrintable has an overload which takes a bool.  This means that const
qualified Exprs would get forwarded to the bool overload instead of the
Expr overload.

llvm-svn: 224844

9 years agoWIP
David Majnemer [Fri, 26 Dec 2014 06:06:53 +0000 (06:06 +0000)]
WIP

llvm-svn: 224843

9 years ago[PowerPC] [FastISel] i1 constants must be zero extended
Hal Finkel [Thu, 25 Dec 2014 23:08:25 +0000 (23:08 +0000)]
[PowerPC] [FastISel] i1 constants must be zero extended

When materializing constant i1 values, they must be zero extended. We represent
i1 values as [0, 1], not [0, -1], in i32 registers. As it turns out, this code
path was dead for i1 values prior to r216006 (which is why this did not manifest in
miscompiles until recently).

Fixes -O0 self-hosting on PPC64/Linux.

llvm-svn: 224842

9 years ago[sanitizer] Tweak sancov.py output.
Evgeniy Stepanov [Thu, 25 Dec 2014 16:03:24 +0000 (16:03 +0000)]
[sanitizer] Tweak sancov.py output.

llvm-svn: 224841

9 years ago[sanitizer] sancov.py: print status to stderr
Evgeniy Stepanov [Thu, 25 Dec 2014 16:01:09 +0000 (16:01 +0000)]
[sanitizer] sancov.py: print status to stderr

llvm-svn: 224840

9 years ago[asan] Disable __sanitizer_cov_dump registration on Windows.
Evgeniy Stepanov [Thu, 25 Dec 2014 15:11:00 +0000 (15:11 +0000)]
[asan] Disable __sanitizer_cov_dump registration on Windows.

Looks like we can't use atexit() during ASan initialization on Windows.

llvm-svn: 224839

9 years ago[asan] Allow enabling coverage at activation.
Evgeniy Stepanov [Thu, 25 Dec 2014 14:26:45 +0000 (14:26 +0000)]
[asan] Allow enabling coverage at activation.

llvm-svn: 224838

9 years agoSimplify allocator_returns_null.cc test
Timur Iskhodzhanov [Thu, 25 Dec 2014 13:03:58 +0000 (13:03 +0000)]
Simplify allocator_returns_null.cc test

llvm-svn: 224837

9 years agoInitialize BackendConsumer::Context in constructor.
Yaron Keren [Thu, 25 Dec 2014 12:21:56 +0000 (12:21 +0000)]
Initialize BackendConsumer::Context in constructor.

llvm-svn: 224836

9 years agoInitialize CodeGeneratorImpl::Ctx in constructor.
Yaron Keren [Thu, 25 Dec 2014 11:38:15 +0000 (11:38 +0000)]
Initialize CodeGeneratorImpl::Ctx in constructor.

llvm-svn: 224835

9 years agotsan: fix trace initialization during thread id reuse
Dmitry Vyukov [Thu, 25 Dec 2014 10:32:25 +0000 (10:32 +0000)]
tsan: fix trace initialization during thread id reuse

The current code leaves the first event in the trace part uninitialized
(from the previous thread). It can cause unpredictable behavior
during stack/mutexset restoration.
Initialize the first event to a fake harmless memory access.

llvm-svn: 224834

9 years agoSilence GCC's -Wparentheses warning
David Majnemer [Thu, 25 Dec 2014 10:03:23 +0000 (10:03 +0000)]
Silence GCC's -Wparentheses warning

No functionality change intended.

llvm-svn: 224833

9 years agoDocumentation for Masked Load and Store intrinsics.
Elena Demikhovsky [Thu, 25 Dec 2014 09:29:13 +0000 (09:29 +0000)]
Documentation for Masked Load and Store intrinsics.

llvm-svn: 224832

9 years ago[Mips] Replace stderr output by the `llvm_unreachable` call
Simon Atanasyan [Thu, 25 Dec 2014 09:23:47 +0000 (09:23 +0000)]
[Mips] Replace stderr output by the `llvm_unreachable` call

If a regular symbol has microMIPS-bit we need to stop linking. Now the
LLD does not check the `applyRelocation` return value and continues
linking anyway. As a temporary workaround use the `llvm_unreachable`
call to stop the linker.

llvm-svn: 224831

9 years ago[Mips] Make the test more tolerant to the linker output order
Simon Atanasyan [Thu, 25 Dec 2014 09:23:37 +0000 (09:23 +0000)]
[Mips] Make the test more tolerant to the linker output order

The LLD output in the YAML mode depends on LLD_RUN_ROUNDTRIP_TEST
environment variable. Do not check unimportant YAML items like section-name.

llvm-svn: 224830

9 years agoMasked Load/Store - Changed the order of parameters in intrinsics.
Elena Demikhovsky [Thu, 25 Dec 2014 07:49:20 +0000 (07:49 +0000)]
Masked Load/Store - Changed the order of parameters in intrinsics.
No functional changes.
The documentation is coming.

llvm-svn: 224829

9 years agoCodeGen: Error on redefinitions instead of asserting
David Majnemer [Wed, 24 Dec 2014 23:06:55 +0000 (23:06 +0000)]
CodeGen: Error on redefinitions instead of asserting

It's possible to have a prior definition of a symbol in module asm.
Raise an error instead of crashing.

llvm-svn: 224828

9 years agoCodeGen: Allow aliases to be overridden by variables
David Majnemer [Wed, 24 Dec 2014 22:44:29 +0000 (22:44 +0000)]
CodeGen: Allow aliases to be overridden by variables

llvm-svn: 224827

9 years ago[Mips] Support linking of microMIPS 32-bit code
Simon Atanasyan [Wed, 24 Dec 2014 21:04:05 +0000 (21:04 +0000)]
[Mips] Support linking of microMIPS 32-bit code

The change is rather large but mainly it just adds handling of new relocations,
PLT entries etc.

llvm-svn: 224826

9 years agoMC: address some comments in deprecation checks
Saleem Abdulrasool [Wed, 24 Dec 2014 18:40:42 +0000 (18:40 +0000)]
MC: address some comments in deprecation checks

Bob Wilson pointed out the unnecessary checks that had been committed to the
instruction check predicates.  The check was meant to ensure that the check was
not accidentally applied to non-ARM instructions.  This is better served as an
assertion rather than a condition check.

llvm-svn: 224825

9 years ago[asan] Support ASAN_ACTIVATION_OPTIONS.
Evgeniy Stepanov [Wed, 24 Dec 2014 16:58:50 +0000 (16:58 +0000)]
[asan] Support ASAN_ACTIVATION_OPTIONS.

This is mostly useful for testing, as the only other way of specifying
activation options (Android system property) is system-wide and affects
concurrently running tests.

llvm-svn: 224824

9 years ago[ASan/Win] Bandaid fix for PR22025 -- deadlocks when creating suspended threads
Timur Iskhodzhanov [Wed, 24 Dec 2014 16:14:16 +0000 (16:14 +0000)]
[ASan/Win] Bandaid fix for PR22025 -- deadlocks when creating suspended threads

llvm-svn: 224823

9 years ago[sanitizer] Disable InternalMmapWithOffset test on OSX.
Evgeniy Stepanov [Wed, 24 Dec 2014 13:59:35 +0000 (13:59 +0000)]
[sanitizer] Disable InternalMmapWithOffset test on OSX.

llvm-svn: 224822

9 years ago[sanitizer] Fix off-by-8x in direct coverage.
Evgeniy Stepanov [Wed, 24 Dec 2014 13:57:11 +0000 (13:57 +0000)]
[sanitizer] Fix off-by-8x in direct coverage.

File mapping offset was calculated by offsetting (uptr *) instead of (char *).

llvm-svn: 224821

9 years ago[sanitizer] Disable InternalMmapWithOffset test on Windows.
Evgeniy Stepanov [Wed, 24 Dec 2014 13:05:21 +0000 (13:05 +0000)]
[sanitizer] Disable InternalMmapWithOffset test on Windows.

llvm-svn: 224820

9 years ago[sanitizer] mmap2 syscall works with 4096-byte units instead of bytes.
Evgeniy Stepanov [Wed, 24 Dec 2014 12:58:09 +0000 (12:58 +0000)]
[sanitizer] mmap2 syscall works with 4096-byte units instead of bytes.

Ouch.

llvm-svn: 224819

9 years ago[asan] Disable one test on Android.
Evgeniy Stepanov [Wed, 24 Dec 2014 12:23:15 +0000 (12:23 +0000)]
[asan] Disable one test on Android.

It used to pass by chance and started failing on recent Android builds.

llvm-svn: 224818

9 years ago[Mips] Join two if statements
Simon Atanasyan [Wed, 24 Dec 2014 12:19:42 +0000 (12:19 +0000)]
[Mips] Join two if statements

No functional changes.

llvm-svn: 224817

9 years ago[Mips] Make the comment more descriptive
Simon Atanasyan [Wed, 24 Dec 2014 12:19:36 +0000 (12:19 +0000)]
[Mips] Make the comment more descriptive

No functional changes.

llvm-svn: 224816

9 years ago[Mips] Factor out the code checks a symbol's binding
Simon Atanasyan [Wed, 24 Dec 2014 12:19:30 +0000 (12:19 +0000)]
[Mips] Factor out the code checks a symbol's binding

No functional changes.

llvm-svn: 224815

9 years ago[Mips] Rename the function s/readAddend/getAddend/
Simon Atanasyan [Wed, 24 Dec 2014 12:19:24 +0000 (12:19 +0000)]
[Mips] Rename the function s/readAddend/getAddend/

No functional changes.

llvm-svn: 224814

9 years ago[Mips] Use OR operation to set the microMIPS bit
Simon Atanasyan [Wed, 24 Dec 2014 12:19:18 +0000 (12:19 +0000)]
[Mips] Use OR operation to set the microMIPS bit

llvm-svn: 224813

9 years ago[ASan] Fix asan_preload_test-2 on PowerPC64 Linux
Jay Foad [Wed, 24 Dec 2014 11:48:40 +0000 (11:48 +0000)]
[ASan] Fix asan_preload_test-2 on PowerPC64 Linux

Summary:
This test failed because clang compiled the call to memset() into a
single sth instruction, instead of a call. Fix it by using write() instead
of memset().

Reviewers: kcc, samsonov, garious, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 224812

9 years agoMC: Label definitions are permitted after .set directives
David Majnemer [Wed, 24 Dec 2014 10:27:50 +0000 (10:27 +0000)]
MC: Label definitions are permitted after .set directives

.set directives may be overridden by other .set directives as well as
label definitions.

This fixes PR22019.

llvm-svn: 224811

9 years agoIAS: correct debug line info for asm macros
Saleem Abdulrasool [Wed, 24 Dec 2014 06:32:43 +0000 (06:32 +0000)]
IAS: correct debug line info for asm macros

Correct the line information generation for preprocessed assembly.  Although we
tracked the source information for the macro instantiation, we failed to account
for the fact that we were instantiating a macro, which is populated into a new
buffer and that the line information would be relative to the definition rather
than the actual instantiation location.  This could cause the line number
associated with the statement to be very high due to wrapping of the difference
calculated for the preprocessor line information emitted into the stream.
Properly calculate the line for the macro instantiation, referencing the line
where the macro is actually used as GCC/gas do.

The test case uses x86, though the same problem exists on any other target using
the LLVM IAS.

llvm-svn: 224810

9 years ago[X86] Remove the single AdSize indicator and replace it with separate AdSize16/32...
Craig Topper [Wed, 24 Dec 2014 06:05:22 +0000 (06:05 +0000)]
[X86] Remove the single AdSize indicator and replace it with separate AdSize16/32/64 flags.

This removes a hardcoded list of instructions in the CodeEmitter. Eventually I intend to remove the predicates on the affected instructions since in any given mode two of them are valid if we supported addr32/addr16 prefixes in the assembler.

llvm-svn: 224809

9 years agoMC: Don't emit .no_dead_strip on targets which don't support it
David Majnemer [Wed, 24 Dec 2014 04:11:42 +0000 (04:11 +0000)]
MC: Don't emit .no_dead_strip on targets which don't support it

llvm-svn: 224808

9 years agoLiveInterval: Remove accidentally committed debug code.
Matthias Braun [Wed, 24 Dec 2014 02:35:07 +0000 (02:35 +0000)]
LiveInterval: Remove accidentally committed debug code.

llvm-svn: 224807

9 years agoLiveInterval: Introduce createMainRangeFromSubranges().
Matthias Braun [Wed, 24 Dec 2014 02:11:51 +0000 (02:11 +0000)]
LiveInterval: Introduce createMainRangeFromSubranges().

This function constructs the main liverange by merging all subranges if
subregister liveness tracking is available. This should be slightly
faster to compute instead of performing the liveness calculation again
for the main range. More importantly it avoids cases where the main
liverange would cover positions where no subrange was live. These cases
happened for partial definitions where the actual defined part was dead
and only the undefined parts used later.

The register coalescing requires that every part covered by the main
live range has at least one subrange live.

I also expect this function to become usefull later for places where the
subranges are modified in a way that it is hard to correctly fix the
main liverange in the machine scheduler, we can simply reconstruct it
from subranges then.

llvm-svn: 224806

9 years agoRegisterCoalescer: With subrange liveness there may be no RedefVNI for unused lanes.
Matthias Braun [Wed, 24 Dec 2014 02:11:48 +0000 (02:11 +0000)]
RegisterCoalescer: With subrange liveness there may be no RedefVNI for unused lanes.

llvm-svn: 224805

9 years agoLiveRangeEdit: Check for completely empy subranges after removing ValNos.
Matthias Braun [Wed, 24 Dec 2014 02:11:46 +0000 (02:11 +0000)]
LiveRangeEdit: Check for completely empy subranges after removing ValNos.

Completely empty subranges are not allowed and must be removed when
subreg liveness is enabled.

llvm-svn: 224804

9 years agoLiveIntervalAnalysis: Fix performance bug that I introduced in r224663.
Matthias Braun [Wed, 24 Dec 2014 02:11:43 +0000 (02:11 +0000)]
LiveIntervalAnalysis: Fix performance bug that I introduced in r224663.

Without a reference the code did not remember when moving the iterators
of the subranges/registerunit ranges forward and instead would scan from
the beginning again at the next position.

llvm-svn: 224803

9 years ago[OCaml] PR21901: Update tests.
Peter Zotov [Wed, 24 Dec 2014 01:58:45 +0000 (01:58 +0000)]
[OCaml] PR21901: Update tests.

This finishes the fix partially applied by r224782.

llvm-svn: 224802

9 years ago[OCaml] Expose Llvm_executionengine.get_{global_value,function}_address.
Peter Zotov [Wed, 24 Dec 2014 01:52:51 +0000 (01:52 +0000)]
[OCaml] Expose Llvm_executionengine.get_{global_value,function}_address.

Patch by Ramkumar Ramachandra <artagnon@gmail.com>.

Also remove Llvm_executionengine.get_pointer_to_global, as it
is actually deprecated and didn't appear in a stable release.

llvm-svn: 224801

9 years ago[SROA] Update the documentation and names for accessing the slices
Chandler Carruth [Wed, 24 Dec 2014 01:48:09 +0000 (01:48 +0000)]
[SROA] Update the documentation and names for accessing the slices
within a partition of an alloca in SROA.

This reflects the fact that the organization of the slices isn't really
ideal for analysis, but is the naive way in which the slices are
available while we're processing them in the core partitioning
algorithm.

It is possible we could improve matters, and I've left a FIXME with
one of my ideas for how to do this, but it is a lot of work, the benefit
is somewhat minor, and it isn't clear that it would be strictly better.
=/ Not really satisfying, but I'm out of really good ideas.

This also improves one place where the debug logging failed to mark some
split partitions. Now we log in one place, slightly later, and with
accurate information about whether the slice is split by the partition
being rewritten.

llvm-svn: 224800