platform/upstream/llvm.git
8 years agoCleanup C++03 __invoke for Bullets 3 and 4.
Eric Fiselier [Tue, 28 Jul 2015 02:15:53 +0000 (02:15 +0000)]
Cleanup C++03 __invoke for Bullets 3 and 4.

The key changes in this patch are:

1. Remove the zero-argument overload in mem_fn. A member function must always
   be invoked with at least one argument, the class instance. The zero-argument
   operator()() in mem_fn would cause mem_fn to fail to compile when because
   the call to '__invoke(pm)' is not well formed.

2. Prevent evaluation of '__apply_cv<Tp, Ret>' when 'Ret' is a function type.
   'Ret' is a function type whenever 'Ret Tp::*' is a pointer to member function.
   Attempting to add cv and ref qualifiers to a function type can cause a hard
   compile error.

3. Remove the dummy overload __invoke(Rp Tp::*). It was present to help work
   around #1. It will be replaced with a different '__invoke' overload that
   represents a bad call to invoke.

After applying this patch the test func.wrap.func.inv/invoke.pass.cpp now
passes.

llvm-svn: 243370

8 years agoThere is no reason why this formatter should not cascade. Make it cascade
Enrico Granata [Tue, 28 Jul 2015 02:13:03 +0000 (02:13 +0000)]
There is no reason why this formatter should not cascade. Make it cascade

llvm-svn: 243369

8 years agoGet C++03 __invoke working for bullet 5 of INVOKE.
Eric Fiselier [Tue, 28 Jul 2015 01:52:08 +0000 (01:52 +0000)]
Get C++03 __invoke working for bullet 5 of INVOKE.

This patch does a couple of things to get __invoke working for free-functions
and call objects.

1. Turn all uses of declval<Tp>() into declval<Tp&>(). The C++03 __invoke only
   supports lvalues but it will be used when the compiler supports rvalue
   references but not variadic templates. This change makes sure we don't
   generate an rvalue.

2. Call objects for bullet 5 are now passed by reference and not value. Copying
   the functor is incorrect. It will fail to compile for non-copyable functors
   and it will discard cv-qualifiers on the call object, possibly leading to the
   wrong function being called. I suspect that the reason the call object
   was originally taken by value was to support temporary call objects.
   However __invoke is only used internally and it is never given a temporary.

llvm-svn: 243368

8 years agoSecond attempt at the fix for the recursion in ValueObjectChild::CanUpdateWithInvalid...
Enrico Granata [Tue, 28 Jul 2015 01:45:23 +0000 (01:45 +0000)]
Second attempt at the fix for the recursion in ValueObjectChild::CanUpdateWithInvalidExecutionContext()

This one should prevent the previous issues, and be the one true fix for rdar://21949558

llvm-svn: 243367

8 years agoChecking more __invoke tests.
Eric Fiselier [Tue, 28 Jul 2015 01:25:36 +0000 (01:25 +0000)]
Checking more __invoke tests.

Before I start trying to fix __invoke in C++03 it needs better test coverage.
This patch adds a large amount of tests for __invoke.

llvm-svn: 243366

8 years ago[libFuzzer] ensure that the dfsan tracing hooks actually run (using -verbosity=3...
Kostya Serebryany [Tue, 28 Jul 2015 01:25:00 +0000 (01:25 +0000)]
[libFuzzer] ensure that the dfsan tracing hooks actually run (using -verbosity=3 in tests)

llvm-svn: 243365

8 years agoCOFF: Skip non-DWARF debug info sections.
Rui Ueyama [Tue, 28 Jul 2015 01:06:58 +0000 (01:06 +0000)]
COFF: Skip non-DWARF debug info sections.

Leaving them in an executable is basically harmless but wastes disk space.
Because no one is using non-DWARF debug info linked by LLD, we can just
remove them.

llvm-svn: 243364

8 years ago[libFuzzer] when using cmp traces, first check that the CMP is evaluated to one value...
Kostya Serebryany [Tue, 28 Jul 2015 00:59:53 +0000 (00:59 +0000)]
[libFuzzer] when using cmp traces, first check that the CMP is evaluated to one value much more frequently than to the other value (heuristic)

llvm-svn: 243363

8 years ago[dfsan/libFuzzer] correctly ignore sanitizer coverage calls in dfsan
Kostya Serebryany [Tue, 28 Jul 2015 00:57:07 +0000 (00:57 +0000)]
[dfsan/libFuzzer] correctly ignore sanitizer coverage calls in dfsan

llvm-svn: 243362

8 years agofix invalid load folding with SSE/AVX FP logical instructions (PR22371)
Sanjay Patel [Tue, 28 Jul 2015 00:48:32 +0000 (00:48 +0000)]
fix invalid load folding with SSE/AVX FP logical instructions (PR22371)

This is a follow-up to the FIXME that was added with D7474 ( http://reviews.llvm.org/rL229531 ).
I thought this load folding bug had been made hard-to-hit, but it turns out to be very easy
when targeting 32-bit x86 and causes a miscompile/crash in Wine:
https://bugs.winehq.org/show_bug.cgi?id=38826
https://llvm.org/bugs/show_bug.cgi?id=22371#c25

The quick fix is to simply remove the scalar FP logical instructions from the load folding table
in X86InstrInfo, but that causes us to miss load folds that should be possible when lowering fabs,
fneg, fcopysign. So the majority of this patch is altering those lowerings to use *vector* FP
logical instructions (because that's all x86 gives us anyway). That lets us do the load folding
legally.

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

llvm-svn: 243361

8 years agoInstrProf: Fix a misuse of the FunctionDecl API when generating coverage
Justin Bogner [Tue, 28 Jul 2015 00:41:51 +0000 (00:41 +0000)]
InstrProf: Fix a misuse of the FunctionDecl API when generating coverage

This was calling FD->hasBody(), meaning "Does the function that this
decl refers to have a body?", rather than
FD->doesThisDeclarationHaveABody(), meaning "Is this decl a
non-deleted definition?".

We might want to consider renaming these APIs :/

llvm-svn: 243360

8 years ago[sanitizer] Fix FreeBSD build of sanitizer_common.
Evgeniy Stepanov [Tue, 28 Jul 2015 00:29:47 +0000 (00:29 +0000)]
[sanitizer] Fix FreeBSD build of sanitizer_common.

Broken in r243051.

llvm-svn: 243359

8 years agoUse SmallDenseMap instead of std::map where we don't care about order of keys.
Rui Ueyama [Tue, 28 Jul 2015 00:17:25 +0000 (00:17 +0000)]
Use SmallDenseMap instead of std::map where we don't care about order of keys.

llvm-svn: 243358

8 years ago[LSR] Move X86 specific test case to X86/
Sanjoy Das [Tue, 28 Jul 2015 00:13:42 +0000 (00:13 +0000)]
[LSR] Move X86 specific test case to X86/

rL243348 added the test case in the wrong directory.

llvm-svn: 243357

8 years ago[opaque pointer type] Avoid using pointee types to retrieve InlineAsm's function...
David Blaikie [Tue, 28 Jul 2015 00:06:38 +0000 (00:06 +0000)]
[opaque pointer type] Avoid using pointee types to retrieve InlineAsm's function type

As a stop-gap, retrieving the InlineAsm's function type was done via the
pointee type of its (pointer) Value type.

Instead, pass down and store the FunctionType in the InlineAsm object.

The only wrinkle with this is the ConstantUniqueMap, which then needs to
ferry the FunctionType down through the InlineAsmKeyType. This could be
done a bit differently if the ConstantInfo trait were broadened a bit to
provide an extension point for access to the TypeClass object from the
ValType objects, so that the ConstantUniqueMap<InlineAsm> would then be
keyed on FunctionTypes instead of PointerTypes that point to
FunctionTypes.

This drops the number of IR tests that don't roundtrip through bitcode*
without calling PointerType::getElementType from 416 to 8 (out of
10733). 3 of those crash when roundtripping at ToT anyway.

* modulo various unavoidable uses of pointer types when validating IR
  (for now) and in the way globals are parsed, unfortunately. These
  cases will either go away (because such validation will no longer be
  necessary or possible when pointee types are opaque), or have to be
  made simultaneously with the removal of pointee types.

llvm-svn: 243356

8 years ago[test] Follow-up for r243343, also add a test case using an enum for designated enum.
Argyrios Kyrtzidis [Tue, 28 Jul 2015 00:01:13 +0000 (00:01 +0000)]
[test] Follow-up for r243343, also add a test case using an enum for designated enum.

llvm-svn: 243355

8 years ago[LAA] Split out a helper to print a collection of memchecks
Adam Nemet [Mon, 27 Jul 2015 23:54:41 +0000 (23:54 +0000)]
[LAA] Split out a helper to print a collection of memchecks

This is effectively an NFC but we can no longer print the index of the
pointer group so instead I print its address.  This still lets us
cross-check the section that list the checks against the section that
list the groups (see how I modified the test).

E.g. before we printed this:

    Run-time memory checks:
    Check 0:
      Comparing group 0:
        %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
        %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
      Against group 1:
        %arrayidxA = getelementptr i16, i16* %a, i64 %ind
        %arrayidxA1 = getelementptr i16, i16* %a, i64 %add
    ...
    Grouped accesses:
      Group 0:
        (Low: %c High: (78 + %c))
          Member: {%c,+,4}<%for.body>
          Member: {(2 + %c),+,4}<%for.body>

Now we print this (changes are underlined):

    Run-time memory checks:
    Check 0:
      Comparing group (0x7f9c6040c320):
                       ~~~~~~~~~~~~~~
        %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
        %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
      Against group (0x7f9c6040c358):
                     ~~~~~~~~~~~~~~
        %arrayidxA1 = getelementptr i16, i16* %a, i64 %add
        %arrayidxA = getelementptr i16, i16* %a, i64 %ind
    ...
    Grouped accesses:
      Group 0x7f9c6040c320:
            ~~~~~~~~~~~~~~
        (Low: %c High: (78 + %c))
          Member: {(2 + %c),+,4}<%for.body>
          Member: {%c,+,4}<%for.body>

llvm-svn: 243354

8 years ago[ARM] Implement -Wa,-mfpu and friends for assemblers
Renato Golin [Mon, 27 Jul 2015 23:44:45 +0000 (23:44 +0000)]
[ARM] Implement -Wa,-mfpu and friends for assemblers

This patch allows Clang to pass on -Wa,-mfpu, -Wa,-mhwdiv and
-Wa,-mcpu to the integrated assembler (via target-features), but
-march is still not being passed, but validated.

In case the command line has both -mxxx and -Wa,-mxxx, we warn
that the naked one will not be used in assembler mode.

llvm-svn: 243353

8 years ago[ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc)
Renato Golin [Mon, 27 Jul 2015 23:44:42 +0000 (23:44 +0000)]
[ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc)

To be able to handle -Wa, options in the assembler (ClangAs), we need to
make the handling of options based on the value of the options, not direct
Arguments from the list, since the list is immutable.

No functional change in this patch, but this allows validating of -Wa,-mfpu
and friends in the same way we validate -mfpu and friends, *just* for the
assembler.

llvm-svn: 243352

8 years agofix typo; NFC
Sanjay Patel [Mon, 27 Jul 2015 23:43:09 +0000 (23:43 +0000)]
fix typo; NFC

llvm-svn: 243351

8 years agoCOFF: Write import library symbols to a symbol table.
Rui Ueyama [Mon, 27 Jul 2015 23:40:20 +0000 (23:40 +0000)]
COFF: Write import library symbols to a symbol table.

Previously no __imp_ symbols nor dllimport thunk functions were
written to a symbol table.

llvm-svn: 243350

8 years ago[opaque pointers] Avoid the use of pointee types when parsing inline asm in IR
David Blaikie [Mon, 27 Jul 2015 23:32:19 +0000 (23:32 +0000)]
[opaque pointers] Avoid the use of pointee types when parsing inline asm in IR

When parsing calls to inline asm the pointee type (of the pointer type
representing the value type of the InlineAsm value) was used. To avoid
using it, use the ValID structure to ferry the FunctionType directly
through to the InlineAsm construction.

This is a bit of a workaround - alternatively the inline asm could
explicitly describe the type but that'd be verbose/redundant in the IR
and so long as the inline asm calls directly in the context of a call or
invoke, this should suffice.

llvm-svn: 243349

8 years ago[LSR] Generate and use zero extends
Sanjoy Das [Mon, 27 Jul 2015 23:27:51 +0000 (23:27 +0000)]
[LSR] Generate and use zero extends

Summary:
If a scale or a base register can be rewritten as "Zext({A,+,1})" then
LSR will now consider a formula of that form in its normal cost
computation.

Depends on D9180

Reviewers: qcolombet, atrick

Subscribers: llvm-commits

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

llvm-svn: 243348

8 years ago[TargetTransformInfo][NFCI] Add TargetTransformInfo::isZExtFree.
Sanjoy Das [Mon, 27 Jul 2015 23:27:43 +0000 (23:27 +0000)]
[TargetTransformInfo][NFCI] Add TargetTransformInfo::isZExtFree.

Summary:
This function is not used in this change but will be used in a
subsequent change.

Reviewers: mcrosier, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 243347

8 years agoCOFF: Add REQUIRES arm to tests which use the ARM disassembler.
Rui Ueyama [Mon, 27 Jul 2015 23:27:03 +0000 (23:27 +0000)]
COFF: Add REQUIRES arm to tests which use the ARM disassembler.

llvm-svn: 243346

8 years agoWebAssembly: add a generic CPU
JF Bastien [Mon, 27 Jul 2015 23:25:54 +0000 (23:25 +0000)]
WebAssembly: add a generic CPU

Summary: WebAssemblySubtarget.cpp expects a default 'generic' CPU to exist, and this seems to be prevalent with other targets. It makes sense to have something between MVP and bleeding-edge, even though for now it's the same as MVP. This removes a warning that's currently generated.

Subscribers: jfb, llvm-commits, sunfish

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

llvm-svn: 243345

8 years agoMake sure we detect symbols in the new __DATA_DIRTY and __DATA_CONST segments and...
Greg Clayton [Mon, 27 Jul 2015 23:21:05 +0000 (23:21 +0000)]
Make sure we detect symbols in the new __DATA_DIRTY and __DATA_CONST segments and classify them correctly.

<rdar://problem/20942073>

llvm-svn: 243344

8 years ago[sema] Fix infinite loop when using a boolean value as designated initializer.
Argyrios Kyrtzidis [Mon, 27 Jul 2015 23:16:53 +0000 (23:16 +0000)]
[sema] Fix infinite loop when using a boolean value as designated initializer.

For designated indices use the max array size type bitwidth, not the bitwidth of the index value itself.
rdar://21942503

llvm-svn: 243343

8 years agoFix test suite. For now we can't disable C++ for expressions since the return value...
Greg Clayton [Mon, 27 Jul 2015 23:02:14 +0000 (23:02 +0000)]
Fix test suite. For now we can't disable C++ for expressions since the return value is returned as a reference and this test fails on MacOSX.

llvm-svn: 243342

8 years agoTweak llvm/test/CodeGen/X86/virtual-registers-cleared-in-machine-functions-liveins...
NAKAMURA Takumi [Mon, 27 Jul 2015 23:01:41 +0000 (23:01 +0000)]
Tweak llvm/test/CodeGen/X86/virtual-registers-cleared-in-machine-functions-liveins.ll not to fail for targeting win32.

llvm-svn: 243341

8 years agoMIR Serialization: Serialize the unnamed basic block references.
Alex Lorenz [Mon, 27 Jul 2015 22:42:41 +0000 (22:42 +0000)]
MIR Serialization: Serialize the unnamed basic block references.

This commit serializes the references from the machine basic blocks to the
unnamed basic blocks.

This commit adds a new attribute to the machine basic block's YAML mapping
called 'ir-block'. This attribute contains the actual reference to the
basic block.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 243340

8 years agoWebAssembly: more MCAsmInfo nits.
JF Bastien [Mon, 27 Jul 2015 22:40:31 +0000 (22:40 +0000)]
WebAssembly: more MCAsmInfo nits.

Summary: As suggested by sunfish.

Subscribers: jfb, llvm-commits, sunfish

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

llvm-svn: 243339

8 years ago[llvm-mc] Add --no-warn flag with -W alias to disable outputting warnings while assem...
Colin LeMahieu [Mon, 27 Jul 2015 22:39:14 +0000 (22:39 +0000)]
[llvm-mc] Add --no-warn flag with -W alias to disable outputting warnings while assembling.

llvm-svn: 243338

8 years agoFix -Wmicrosoft-enum warning
Reid Kleckner [Mon, 27 Jul 2015 22:35:50 +0000 (22:35 +0000)]
Fix -Wmicrosoft-enum warning

llvm-svn: 243337

8 years agoIR: Expose the method 'getLocalSlot' in the module slot tracker.
Alex Lorenz [Mon, 27 Jul 2015 22:31:04 +0000 (22:31 +0000)]
IR: Expose the method 'getLocalSlot' in the module slot tracker.

This commit publicly exposes the method 'getLocalSlot' in the
'ModuleSlotTracker' class.

This change is useful for MIR serialization, to serialize the unnamed basic
block and unnamed alloca references.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 243336

8 years ago- Added support for parsing HWDiv features using Target Parser.
Alexandros Lamprineas [Mon, 27 Jul 2015 22:26:59 +0000 (22:26 +0000)]
- Added support for parsing HWDiv features using Target Parser.
- Architecture extensions are represented as a bitmap.

Phabricator: http://reviews.llvm.org/D11457
llvm-svn: 243335

8 years ago[llvm-mc] Pushing plumbing through for --fatal-warnings flag.
Colin LeMahieu [Mon, 27 Jul 2015 21:56:53 +0000 (21:56 +0000)]
[llvm-mc] Pushing plumbing through for --fatal-warnings flag.

llvm-svn: 243334

8 years agoDeprecate `SBValue::TypeIsPointerType`.
Chaoren Lin [Mon, 27 Jul 2015 21:51:56 +0000 (21:51 +0000)]
Deprecate `SBValue::TypeIsPointerType`.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 243333

8 years agoFix Windows buildbot failure after rev 243301
Ying Chen [Mon, 27 Jul 2015 21:47:14 +0000 (21:47 +0000)]
Fix Windows buildbot failure after rev 243301

Summary:
- Visual Studio doesn't support "list initialization inside member initializer list"
- Call inner struct constructor explicitly

Reviewers:
enrico
Subscribers:
lldb-commits

llvm-svn: 243332

8 years ago[IndVars] Make loop varying predicates loop invariant.
Sanjoy Das [Mon, 27 Jul 2015 21:42:49 +0000 (21:42 +0000)]
[IndVars] Make loop varying predicates loop invariant.

Summary:
Was D9784: "Remove loop variant range check when induction variable is
strictly increasing"

This change re-implements D9784 with the two differences:

 1. It does not use SCEVExpander and does not generate new
    instructions.  Instead, it does a quick local search for existing
    `llvm::Value`s that it needs when modifying the `icmp`
    instruction.

 2. It is more general -- it deals with both increasing and decreasing
    induction variables.

I've added all of the tests included with D9784, and two more.

As an example on what this change does (copied from D9784):

Given C code:

```
for (int i = M; i < N; i++) // i is known not to overflow
  if (i < 0) break;
  a[i] = 0;
}
```

This transformation produces:

```
for (int i = M; i < N; i++)
  if (M < 0) break;
  a[i] = 0;
}
```

Which can be unswitched into:

```
if (!(M < 0))
  for (int i = M; i < N; i++)
    a[i] = 0;
}
```

I went back and forth on whether the top level logic should live in
`SimplifyIndvar::eliminateIVComparison` or be put into its own
routine.  Right now I've put it under `eliminateIVComparison` because
even though the `icmp` is not *eliminated*, it no longer is an IV
comparison.  I'm open to putting it in its own helper routine if you
think that is better.

Reviewers: reames, nicholas, atrick

Subscribers: llvm-commits

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

llvm-svn: 243331

8 years agoIf a path contains a '/' before a ':', then the ':' is not a hostname separator,...
Enrico Granata [Mon, 27 Jul 2015 21:27:02 +0000 (21:27 +0000)]
If a path contains a '/' before a ':', then the ':' is not a hostname separator, but just a part of the path (e.g. /tmp/fi:lename vs. pro:/tmp/fi:lename)

llvm-svn: 243330

8 years agoOnly test ObjC expression options on Darwin.
Chaoren Lin [Mon, 27 Jul 2015 21:15:01 +0000 (21:15 +0000)]
Only test ObjC expression options on Darwin.

Reviewers: dawn, emaste, vharron, clayborg

Subscribers: lldb-commits

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

llvm-svn: 243329

8 years agoremove unnecessary forward declaration; NFC
Sanjay Patel [Mon, 27 Jul 2015 21:11:55 +0000 (21:11 +0000)]
remove unnecessary forward declaration; NFC

llvm-svn: 243328

8 years agodon't repeat function names in comments; NFC
Sanjay Patel [Mon, 27 Jul 2015 21:03:03 +0000 (21:03 +0000)]
don't repeat function names in comments; NFC

llvm-svn: 243327

8 years agoWebAssembly: minor MCAsmInfo fixes
JF Bastien [Mon, 27 Jul 2015 20:46:51 +0000 (20:46 +0000)]
WebAssembly: minor MCAsmInfo fixes

Summary:
Fix pointer / callee-save stack sto size.
Update comment character to be LISP-ish.

Subscribers: llvm-commits, sunfish, jfb

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

llvm-svn: 243326

8 years ago[X86][SSE] Added shuffle tests to demonstrate missed bitmask.
Simon Pilgrim [Mon, 27 Jul 2015 20:41:57 +0000 (20:41 +0000)]
[X86][SSE] Added shuffle tests to demonstrate missed bitmask.

llvm-svn: 243324

8 years agoELF2: Inline very small functions.
Rui Ueyama [Mon, 27 Jul 2015 20:39:04 +0000 (20:39 +0000)]
ELF2: Inline very small functions.

llvm-svn: 243323

8 years agoMIR Serialization: Serialize the '.cfi_def_cfa_register' CFI instruction.
Alex Lorenz [Mon, 27 Jul 2015 20:39:03 +0000 (20:39 +0000)]
MIR Serialization: Serialize the '.cfi_def_cfa_register' CFI instruction.

llvm-svn: 243322

8 years agoELF2: Devirtualize SymbolBody::compare. NFC.
Rui Ueyama [Mon, 27 Jul 2015 20:39:01 +0000 (20:39 +0000)]
ELF2: Devirtualize SymbolBody::compare. NFC.

This is to make it consistent with COFF.

llvm-svn: 243321

8 years agoMIR Parser: Rename the standalone parsing methods. NFC.
Alex Lorenz [Mon, 27 Jul 2015 20:29:27 +0000 (20:29 +0000)]
MIR Parser: Rename the standalone parsing methods. NFC.

This commit renames the methods 'parseMBB' and 'parseNamedRegister' to
'parseStandaloneMBB' and 'parseStandaloneNamedRegister' in order for their
names to be consistent with the method 'parseStandaloneVirtualRegister'.

llvm-svn: 243319

8 years agoRevert "[PeepholeOptimizer] Look through PHIs to find additional register sources"
Bruno Cardoso Lopes [Mon, 27 Jul 2015 20:26:04 +0000 (20:26 +0000)]
Revert "[PeepholeOptimizer] Look through PHIs to find additional register sources"

Still breaks some ARM buildbots. This reverts r243271.

llvm-svn: 243318

8 years agoUse CGLoopInfo to emit metadata for loop hint pragmas.
Tyler Nowicki [Mon, 27 Jul 2015 20:10:20 +0000 (20:10 +0000)]
Use CGLoopInfo to emit metadata for loop hint pragmas.

When â€˜#pragma clang loop vectorize(assume_safety)’ was specified on a loop other loop hints were lost. The problem is that CGLoopInfo attaches metadata differently than EmitCondBrHints in CGStmt. For do-loops CGLoopInfo attaches metadata to the br in the body block and for while and for loops, the inc block. EmitCondBrHints on the other hand always attaches data to the br in the cond block. When specifying assume_safety CGLoopInfo emits an empty llvm.loop metadata shadowing the metadata in the cond block. Loop transformations like rotate and unswitch would then eliminate the cond block and its non-empty metadata.

This patch unifies both approaches for adding metadata and modifies the existing safety tests to include non-assume_safety loop hints.

llvm-svn: 243315

8 years agoFixed test in rL243305
Simon Pilgrim [Mon, 27 Jul 2015 19:49:54 +0000 (19:49 +0000)]
Fixed test in rL243305

llvm-svn: 243314

8 years ago[LAA] Upper-case variable names, NFC
Adam Nemet [Mon, 27 Jul 2015 19:38:50 +0000 (19:38 +0000)]
[LAA] Upper-case variable names, NFC

llvm-svn: 243313

8 years ago[LAA] Split out a helper from addRuntimeCheck to generate the check, NFC
Adam Nemet [Mon, 27 Jul 2015 19:38:48 +0000 (19:38 +0000)]
[LAA] Split out a helper from addRuntimeCheck to generate the check, NFC

llvm-svn: 243312

8 years agoRemoving unused function declaration with no definition; NFC.
Aaron Ballman [Mon, 27 Jul 2015 19:34:46 +0000 (19:34 +0000)]
Removing unused function declaration with no definition; NFC.

llvm-svn: 243311

8 years ago[AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin.
Akira Hatanaka [Mon, 27 Jul 2015 19:29:04 +0000 (19:29 +0000)]
[AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin.

After r243308, the front-end is responsible for checking the target OS and
passing reserve-x18 if the target is Darwin.

llvm-svn: 243310

8 years agoXFAIL test_with_dwarf_formatters_api on FreeBSD
Ed Maste [Mon, 27 Jul 2015 19:20:42 +0000 (19:20 +0000)]
XFAIL test_with_dwarf_formatters_api on FreeBSD

llvm.org/pr24282

llvm-svn: 243309

8 years ago[AArch64] Remove check for Darwin that was needed to decide if x18 should
Akira Hatanaka [Mon, 27 Jul 2015 19:18:47 +0000 (19:18 +0000)]
[AArch64] Remove check for Darwin that was needed to decide if x18 should
be reserved.

The decision to reserve x18 is going to be made solely by the front-end,
so it isn't necessary to check if the OS is Darwin in the backend.

llvm-svn: 243308

8 years agoXFAIL TestExprOptions on FreeBSD.
Ed Maste [Mon, 27 Jul 2015 19:10:16 +0000 (19:10 +0000)]
XFAIL TestExprOptions on FreeBSD.

r243230 XFAILed it for Linux; it also fails on FreeBSD.

llvm-svn: 243307

8 years agoFixed signed/unsigned comparison warning.
Simon Pilgrim [Mon, 27 Jul 2015 19:07:15 +0000 (19:07 +0000)]
Fixed signed/unsigned comparison warning.

llvm-svn: 243306

8 years ago[X86] Add missing _m_prefetch intrinsic
Simon Pilgrim [Mon, 27 Jul 2015 19:01:52 +0000 (19:01 +0000)]
[X86] Add missing _m_prefetch intrinsic

The 3DNOW/PRFCHW cpu targets define both the PREFETCHW (set cache line modified) and PREFETCH (set cache line exclusive) instructions but only the _m_prefetchw (PREFETCHW) intrinsic is included in the header. This patch adds the missing _m_prefetch intrinsic.

I'm basing this off AMD documentation - the intel docs on the support for PREFETCHW isn't clear whether Silvermont/Broadwell properly support PREFETCH but given that the intrinsic implementation is a default __builtin_prefetch call, it is safe whatever.

Fix for PR23648

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

llvm-svn: 243305

8 years ago[AArch64][FastISel] Add more truncation tests.
Juergen Ributzka [Mon, 27 Jul 2015 19:00:23 +0000 (19:00 +0000)]
[AArch64][FastISel] Add more truncation tests.

This is a follow-up to r243198 and adds more truncation tests.

llvm-svn: 243304

8 years ago[InstCombine][X86][SSE] Replace sign/zero extension intrinsics with native IR
Simon Pilgrim [Mon, 27 Jul 2015 18:52:15 +0000 (18:52 +0000)]
[InstCombine][X86][SSE] Replace sign/zero extension intrinsics with native IR

Now that we are generating sane codegen for vector sext/zext nodes on SSE targets, this patch uses instcombine to replace the SSE41/AVX2 pmovsx and pmovzx intrinsics with the equivalent native IR code.

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

llvm-svn: 243303

8 years agoRevert "Remove unnecessary null check. NFC."
Pete Cooper [Mon, 27 Jul 2015 18:37:58 +0000 (18:37 +0000)]
Revert "Remove unnecessary null check.  NFC."

This reverts commit r243167.

Duncan pointed out that dyn_cast can return null in these cases, so this
was an unsafe commit to make.  Sorry for the noise.

Worryingly there were no tests which fail...

llvm-svn: 243302

8 years agoAdd a more tweakable way for ValueObjectPrinter to control pointer expansion. NFC.
Enrico Granata [Mon, 27 Jul 2015 18:34:14 +0000 (18:34 +0000)]
Add a more tweakable way for ValueObjectPrinter to control pointer expansion. NFC.

llvm-svn: 243301

8 years agoFix assert when inlining a constantexpr addrspacecast
Matt Arsenault [Mon, 27 Jul 2015 18:31:03 +0000 (18:31 +0000)]
Fix assert when inlining a constantexpr addrspacecast

The pointer size of the addrspacecasted pointer might not have matched,
so this would have hit an assert in accumulateConstantOffset.

I think this was here to allow constant folding of a load of an
addrspacecasted constant. Accumulating the offset through the
addrspacecast doesn't make much sense, so something else is necessary
to allow folding the load through this cast.

llvm-svn: 243300

8 years agoFix ODR violation. NFC.
Diego Novillo [Mon, 27 Jul 2015 18:27:23 +0000 (18:27 +0000)]
Fix ODR violation. NFC.

There is an ODR conflict between lib/ExecutionEngine/ExecutionEngineBindings.cpp
and lib/Target/TargetMachineC.cpp. The inline definitions should simply
be marked static (thanks dblaikie for the hint).

llvm-svn: 243298

8 years agoFix `llvm-config` to emit the linker flag for the combined shared object built by...
JF Bastien [Mon, 27 Jul 2015 18:26:30 +0000 (18:26 +0000)]
Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components.

Summary:
When LLVM is configured to build shared libraries, CMake builds each component as it's own shared object, while autoconfig/make builds them statically and then links them all together to create a single shared object. This change adds compile time config flags to `llvm-config` so it can know whether LLVM's components are separated or not and act accordingly.

This fixes `llvm-config` instead of fixing the makefiles to behave like CMake because, AIUI, LLVM's autoconfig/make build system is on the way out anyway.

This change only affects `llvm-config` from builds that use autoconfig/make.

Reviewers: jfb

Subscribers: echristo, dschuff, llvm-commits

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

llvm-svn: 243297

8 years ago[libcxxabi] Add -funwind-tables to the test compilation options.
Daniel Sanders [Mon, 27 Jul 2015 18:20:17 +0000 (18:20 +0000)]
[libcxxabi] Add -funwind-tables to the test compilation options.

Summary:
backtrace_test.pass.cpp depends on unwind tables. These are generated by
-funwind-tables which is the default for x86 but not for other targets.

Thanks to Nitesh Jain for helping to narrow this down.

Fixes PR24148

Reviewers: jroelofs

Subscribers: cfe-commits, jroelofs, llvm-commits, hans

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

llvm-svn: 243296

8 years agoAMDGPU: don't match vgpr loads for constant loads
Marek Olsak [Mon, 27 Jul 2015 18:16:08 +0000 (18:16 +0000)]
AMDGPU: don't match vgpr loads for constant loads

Author: Dave Airlie <airlied@redhat.com>

In order to implement indirect sampler loads, we don't
want to match on a VGPR load but an SGPR one for constants,
as we cannot feed VGPRs to the sampler only SGPRs.

this should be applicable for llvm 3.7 as well.

llvm-svn: 243294

8 years agomove combineRepeatedFPDivisors logic into a helper function; NFCI
Sanjay Patel [Mon, 27 Jul 2015 17:58:49 +0000 (17:58 +0000)]
move combineRepeatedFPDivisors logic into a helper function; NFCI

llvm-svn: 243293

8 years agoCorrecting a typo in a comment; NFC.
Aaron Ballman [Mon, 27 Jul 2015 17:58:32 +0000 (17:58 +0000)]
Correcting a typo in a comment; NFC.

llvm-svn: 243292

8 years agoSimplify code in BlockGenerator::generateScalarLoads [NFC]
Tobias Grosser [Mon, 27 Jul 2015 17:57:58 +0000 (17:57 +0000)]
Simplify code in BlockGenerator::generateScalarLoads [NFC]

We hoist statements that are used on both branches of an if-condition, shorten
and unify some variable names and fold some variable declarations into their
only uses. We also drop a comment which just describes the elements the loop
iterates over.

No functional change intended.

llvm-svn: 243291

8 years agoReset the virtual registers in liveins when clearing the virtual registers.
Alex Lorenz [Mon, 27 Jul 2015 17:51:59 +0000 (17:51 +0000)]
Reset the virtual registers in liveins when clearing the virtual registers.

This commit zeroes out the virtual register references in the machine
function's liveins in the class 'MachineRegisterInfo' when the virtual
register definitions are cleared.

Reviewers: Matthias Braun
llvm-svn: 243290

8 years ago[OpenMP] Fix copyin codegen test regression in order used in compare
Samuel Antao [Mon, 27 Jul 2015 17:49:18 +0000 (17:49 +0000)]
[OpenMP] Fix copyin codegen test regression in order used in compare
instruction.

llvm-svn: 243289

8 years agoMIR Serialization: Serialize the machine function's liveins.
Alex Lorenz [Mon, 27 Jul 2015 17:42:45 +0000 (17:42 +0000)]
MIR Serialization: Serialize the machine function's liveins.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 243288

8 years agofix typo and spacing; NFC
Sanjay Patel [Mon, 27 Jul 2015 17:39:20 +0000 (17:39 +0000)]
fix typo and spacing; NFC

llvm-svn: 243287

8 years ago[OpenMP] Fix copyin clause codegen regression caused by r243277.
Samuel Antao [Mon, 27 Jul 2015 17:30:41 +0000 (17:30 +0000)]
[OpenMP] Fix copyin clause codegen regression caused by r243277.

llvm-svn: 243285

8 years ago[TableGen] Emit the correct error message.
Davide Italiano [Mon, 27 Jul 2015 17:22:19 +0000 (17:22 +0000)]
[TableGen] Emit the correct error message.

llvm-svn: 243284

8 years agoRevert "Add const to a bunch of Type* in DataLayout. NFC."
Pete Cooper [Mon, 27 Jul 2015 17:15:28 +0000 (17:15 +0000)]
Revert "Add const to a bunch of Type* in DataLayout.  NFC."

This reverts commit r243135.

Feedback from Craig Topper and David Blaikie was that we don't put const on Type as it has no mutable state.

llvm-svn: 243283

8 years agoRevert "Add const to some Type* parameters which didn't need to be mutable. NFC."
Pete Cooper [Mon, 27 Jul 2015 17:15:24 +0000 (17:15 +0000)]
Revert "Add const to some Type* parameters which didn't need to be mutable.  NFC."

This reverts commit r243146.

Feedback from Craig Topper and David Blaikie was that we don't put const on Type as it has no mutable state.

llvm-svn: 243282

8 years ago[lldb-mi] Fix breakpoints on functions when C++ namespaces are used.
Dawn Perchik [Mon, 27 Jul 2015 17:03:34 +0000 (17:03 +0000)]
[lldb-mi] Fix breakpoints on functions when C++ namespaces are used.

The command "-break-insert ns::foo" for function 'foo' in namespace 'ns'
was being parsed as file:function.  This patch fixes these cases by adding
checks for '::'. (Note: '::func' is not parsed correctly by lldb due to
llvm.org/pr24271).

Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11396

llvm-svn: 243281

8 years ago[OpenMP] Add TLS requirement for the copyin clause codegen test. This is an
Samuel Antao [Mon, 27 Jul 2015 16:59:45 +0000 (16:59 +0000)]
[OpenMP] Add TLS requirement for the copyin clause codegen test. This is an
attempt to fix regressions triggered by r243277.

llvm-svn: 243280

8 years agoRename {Hexagon,NaCl}_TC to {Hexagon,NaCl}ToolChain respectively. NFC
Douglas Katzman [Mon, 27 Jul 2015 16:53:08 +0000 (16:53 +0000)]
Rename {Hexagon,NaCl}_TC to {Hexagon,NaCl}ToolChain respectively. NFC

Also rename XCore (the toolchain) to XCoreToolChain since XCore is
also a namespace for its tools.

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

llvm-svn: 243279

8 years ago[OpenMP] Add capture for threadprivate variables used in copyin clause
Samuel Antao [Mon, 27 Jul 2015 16:38:06 +0000 (16:38 +0000)]
[OpenMP] Add capture for threadprivate variables used in copyin clause
if TLS is enabled in OpenMP code generation.

llvm-svn: 243277

8 years agoUpdate Build_With_CMake.txt to reflect changes in CMake refactor
Jonathan Peyton [Mon, 27 Jul 2015 16:23:42 +0000 (16:23 +0000)]
Update Build_With_CMake.txt to reflect changes in CMake refactor

This just updates the documentation regarding how to build libomp with CMake.

llvm-svn: 243276

8 years agoAnalysis: Fix example usage comment in CFG.cpp. NFC
Jonathan Roelofs [Mon, 27 Jul 2015 16:05:36 +0000 (16:05 +0000)]
Analysis: Fix example usage comment in CFG.cpp. NFC

Patch by Vedant Kumar!

llvm-svn: 243275

8 years agoThe tests added in r243270 require asserts to be enabled
Silviu Baranga [Mon, 27 Jul 2015 15:22:49 +0000 (15:22 +0000)]
The tests added in r243270 require asserts to be enabled

llvm-svn: 243274

8 years agoFix the tests added in r243270. Use 2>&1 instead of |&
Silviu Baranga [Mon, 27 Jul 2015 15:08:55 +0000 (15:08 +0000)]
Fix the tests added in r243270. Use 2>&1 instead of |&

llvm-svn: 243273

8 years ago[clang-tidy] Set current main file name in tests.
Alexander Kornienko [Mon, 27 Jul 2015 14:54:31 +0000 (14:54 +0000)]
[clang-tidy] Set current main file name in tests.

llvm-svn: 243272

8 years ago[PeepholeOptimizer] Look through PHIs to find additional register sources
Bruno Cardoso Lopes [Mon, 27 Jul 2015 14:39:46 +0000 (14:39 +0000)]
[PeepholeOptimizer] Look through PHIs to find additional register sources

Reapply r242295 with fixes in the implementation.

- Teaches the ValueTracker in the PeepholeOptimizer to look through PHI
instructions.
- Add findNextSourceAndRewritePHI method to lookup into multiple sources
returnted by the ValueTracker and rewrite PHIs with new sources.

With these changes we can find more register sources and rewrite more
copies to allow coaslescing of bitcast instructions. Hence, we eliminate
unnecessary VR64 <-> GR64 copies in x86, but it could be extended to
other archs by marking "isBitcast" on target specific instructions. The
x86 example follows:

A:
  psllq %mm1, %mm0
  movd  %mm0, %r9
  jmp C

B:
  por %mm1, %mm0
  movd  %mm0, %r9
  jmp C

C:
  movd  %r9, %mm0
  pshufw  $238, %mm0, %mm0

Becomes:

A:
  psllq %mm1, %mm0
  jmp C

B:
  por %mm1, %mm0
  jmp C

C:
  pshufw  $238, %mm0, %mm0

Differential Revision: http://reviews.llvm.org/D11197
rdar://problem/20404526

llvm-svn: 243271

8 years ago[ARM/AArch64] Fix cost model for interleaved accesses
Silviu Baranga [Mon, 27 Jul 2015 14:39:34 +0000 (14:39 +0000)]
[ARM/AArch64] Fix cost model for interleaved accesses

Summary:
Fix the cost of interleaved accesses for ARM/AArch64.
We were calling getTypeAllocSize and using it to check
the number of bits, when we should have called
getTypeAllocSizeInBits instead.

This would pottentially cause the vectorizer to
generate loads/stores and shuffles which cannot
be matched with an interleaved access instruction.

No performance changes are expected for now since
matching/generating interleaved accesses is still
disabled by default.

Reviewers: rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

llvm-svn: 243270

8 years agoTrying again to a failing test the bots found with r243266.
Aaron Ballman [Mon, 27 Jul 2015 13:59:24 +0000 (13:59 +0000)]
Trying again to a failing test the bots found with r243266.

llvm-svn: 243269

8 years agoFixing a failing test the bots found with r243266.
Aaron Ballman [Mon, 27 Jul 2015 13:47:35 +0000 (13:47 +0000)]
Fixing a failing test the bots found with r243266.

llvm-svn: 243268

8 years agomisc-unused-parameters: Don't warn on ParmVarDecls in the return type.
Daniel Jasper [Mon, 27 Jul 2015 13:46:37 +0000 (13:46 +0000)]
misc-unused-parameters: Don't warn on ParmVarDecls in the return type.

As there don't seem to be a good way of formulating a matcher that
finds all pairs of functions and their ParmVarDecls, just match on
functionDecls and iterate over their parameters. This should also be
more efficient as some checks are only performed once per function.

llvm-svn: 243267

8 years agoUpdating the documentation for clang-tidy. Removes some non-ASCII characters from...
Aaron Ballman [Mon, 27 Jul 2015 13:41:30 +0000 (13:41 +0000)]
Updating the documentation for clang-tidy. Removes some non-ASCII characters from the documentation, and removes shell-specific single quote characters as they cause issues for some shells (such as on Windows).

llvm-svn: 243266

8 years ago[clang-tidy] Don't duplicate the leading slash.
Alexander Kornienko [Mon, 27 Jul 2015 13:07:50 +0000 (13:07 +0000)]
[clang-tidy] Don't duplicate the leading slash.

llvm-svn: 243265

8 years ago[X86] Reordered lowerVectorShuffleAsBitMask before lowerVectorShuffleAsBlend. NFCI.
Simon Pilgrim [Mon, 27 Jul 2015 12:37:19 +0000 (12:37 +0000)]
[X86] Reordered lowerVectorShuffleAsBitMask before lowerVectorShuffleAsBlend. NFCI.

Allows us to show diffs for D11518 more clearly

llvm-svn: 243264

8 years agoAMDGPU/SI: Fix the V_FRACT_F64 SI bug workaround
Marek Olsak [Mon, 27 Jul 2015 11:37:42 +0000 (11:37 +0000)]
AMDGPU/SI: Fix the V_FRACT_F64 SI bug workaround

This is a candidate for 3.7.

llvm-svn: 243263