LLVM/llvm 330503llvm/trunk/lib/Target/X86 X86SchedHaswell.td X86SchedBroadwell.td

[X86] Strip unnecessary MMX instruction instrw overrides from scheduler models.

LLVM/llvm 330502llvm/trunk/test/tools/llvm-mca/X86/Broadwell resources-mmx.s, llvm/trunk/test/tools/llvm-mca/X86/Haswell resources-mmx.s

[llvm-mca][X86] Add MMX resource tests

LLVM/llvm 330501llvm/trunk/lib/Target/X86 X86SchedSandyBridge.td X86SchedBroadwell.td

[X86] Strip unnecessary x87 instruction instrw overrides from scheduler models.

LLVM/llvm 330500lldb/trunk/source/Plugins/Process/FreeBSD ProcessMonitor.cpp

FreeBSD: propagate error to user if memory access fails

Previously, an attempt to read an unreadable address reported zeros.
Now, if DoReadMemory or DoWriteMemory encounters error then return 0
(bytes read or written) so that the error is reported to the user.

llvm.org/pr37190

LLVM/llvm 330499llvm/trunk/test/tools/llvm-mca/X86/Broadwell resources-x87.s, llvm/trunk/test/tools/llvm-mca/X86/BtVer2 resources-x87.s

[llvm-mca][X86] Add X87 resource tests

LLVM/llvm 330498llvm/trunk/test/CodeGen/X86 x87-schedule.ll

[X86][X87] Add missing fldlg2 schedule test

LLVM/llvm 330497llvm/trunk/lib/Target/PowerPC PPCISelDAGToDAG.cpp PPCInstrAltivec.td, llvm/trunk/test/CodeGen/PowerPC ppc64-P9-vabsd.ll

[PowerPC] fix incorrect vectorization of abs() on POWER9

Vectorized loops with abs() returns incorrect results on POWER9. This patch fixes it.
For example the following code returns negative result if input values are negative though 
it sums up the absolute value of the inputs.

int vpx_satd_c(const int16_t *coeff, int length) {
  int satd = 0;
  for (int i = 0; i < length; ++i) satd += abs(coeff[i]);
  return satd;
}

This problem causes test failures for libvpx.
For vector absolute and vector absolute difference on POWER9, LLVM generates VABSDUW 
(Vector Absolute Difference Unsigned Word) instruction or variants.
Since these instructions are for unsigned integers, we need adjustment for signed 
integers.
For abs(sub(a, b)), we generate VABSDUW(a+0x80000000, b+0x80000000). Otherwise, 
abs(sub(-1, 0)) returns 0xFFFFFFFF(=-1) instead of 1. For abs(a), we generate 
VABSDUW(a+0x80000000, 0x80000000).

Differential Revision: https://reviews.llvm.org/D45522

LLVM/llvm 330496polly/trunk/lib/External/isl isl_test.c isl_aff.c

Update isl to isl-0.19-107-gc4fe33d8

This is a regular maintenance update.

LLVM/llvm 330495llvm/trunk/lib/CodeGen TargetLoweringBase.cpp, llvm/trunk/test/CodeGen/AArch64 stackguard-internal.ll

[AArch64] Don't crash trying to resolve __stack_chk_guard.

In certain cases, the compiler might try to merge __stack_chk_guard with
another global variable.  (Or someone could theoretically define
__stack_chk_guard as an alias.)  In that case, make sure we don't crash.

Differential Revision: https://reviews.llvm.org/D45746

LLVM/llvm 330494llvm/trunk/test/CodeGen/AArch64 machine-outliner-noredzone.ll

Fix typo in test (verify-machine-instrs -> verify-machineinstrs)

LLVM/llvm 330493llvm/trunk/test/CodeGen/AArch64 machine-outliner-noredzone.ll

[MachineOutliner] XFAIL machine-outliner-noredzone.ll

The verifier began complaining about an undefined physical register in this
test. XFAILing for the purposes of getting a bot up while I look into it.

Failure:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/11385/

LLVM/llvm 330492clang-tools-extra/trunk/clang-tidy/readability IdentifierNamingCheck.cpp, clang-tools-extra/trunk/test/clang-tidy readability-identifier-naming-objc.m

[clang-tidy] add new check to find out objc ivars which do not have prefix '_'

Summary:
For code of ivar declaration:

   int barWithoutPrefix;

The fix will be:

   int _barWithoutPrefix;

Reviewers: benhamilton, hokein, alexfh, aaron.ballman, ilya-biryukov

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, xazax.hun, klimek, mgorny, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D45392

LLVM/llvm 330491lld/trunk/ELF SymbolTable.cpp

[ELF] Swap argument names: use Old to refer to original symbol and New for incoming one

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D45905

LLVM/llvm 330490lld/trunk/COFF Chunks.cpp

Fix nullptr passed to memcpy in lld/COFF/Chunks.cpp

Summary:
ubsan found that we sometimes pass nullptr to memcpy in
SectionChunk::writeTo(). This change adds a check that avoids that.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45789

LLVM/llvm 330489llvm/trunk/lib/Transforms/ObjCARC ObjCARCContract.cpp ObjCARCOpts.cpp

[ObjCARC] Take BlockColors by const reference. NFC

LLVM/llvm 330488lld/trunk/COFF Options.td

COFF: Document /pdbaltpath.

LLVM/llvm 330487llvm/trunk/lib/Transforms/ObjCARC ObjCARCContract.cpp, llvm/trunk/test/Transforms/ObjCARC contract-storestrong-funclet.ll

[ObjCARC] Account for funclet token in storeStrong transform

When creating a call to storeStrong in ObjCARCContract, ensure the call
gets the correct funclet token, otherwise WinEHPrepare will turn the
call (and all subsequent instructions) into unreachable.

We already have logic to do this for the ARC autorelease elision marker;
factor that out into a common function that's used for both. These are
the only two places in this transform that create call instructions.

Differential Revision: https://reviews.llvm.org/D45857

LLVM/llvm 330486llvm/trunk/test/tools/llvm-mca/X86/SandyBridge resources-sse2.s resources-sse1.s

[llvm-mca][X86] Add MMX/SSE/AES/CLMUL resource SandyBridge tests

LLVM/llvm 330485lld/trunk/test/COFF pdb.test

Use /pdbaltpath to avoid a path length dependency.

LLVM/llvm 330484lld/trunk/COFF Driver.cpp, lld/trunk/test/COFF icf-xdata.s pdb.test

COFF: Merge .xdata into .rdata by default.

Differential Revision: https://reviews.llvm.org/D45804

LLVM/llvm 330483lld/trunk/COFF Driver.cpp, lld/trunk/test/COFF secrel-common.s common-alignment.test

COFF: Merge .bss into .data by default.

Differential Revision: https://reviews.llvm.org/D45803

LLVM/llvm 330482lld/trunk/ELF Driver.cpp, lld/trunk/test/ELF relro.s dt_flags.s

Add -z {combreloc,copyreloc,noexecstack,lazy,relro,text}.

Differential Revision: https://reviews.llvm.org/D45902

LLVM/llvm 330481lld/trunk/COFF Chunks.h Writer.cpp, lld/trunk/test/COFF section.test output-chars.test

COFF: Preserve section type when processing /section flag.

It turns out that we were dropping this before.

Differential Revision: https://reviews.llvm.org/D45802

LLVM/llvm 330480llvm/trunk/lib/Target/X86 X86SchedSkylakeServer.td X86SchedBroadwell.td, llvm/trunk/test/CodeGen/X86 avx512-shuffle-schedule.ll avx512-schedule.ll

[X86] Add WriteFSign/WriteFLogic scheduler classes

Split the fp and integer vector logical instruction scheduler classes - older CPUs 
especially often handled these on different pipes.

This unearthed a couple of things that are also handled in this patch:

(1) We were tagging avx512 fp logic ops as WriteFAdd, probably because of the lack of 
WriteFLogic
(2) SandyBridge had integer logic ops only using Port5, when afaict they can use Ports015.
(3) Cleaned up x86 FCHS/FABS scheduling as they are typically treated as fp logic ops.

Differential Revision: https://reviews.llvm.org/D45629

LLVM/llvm 330479lld/trunk/COFF Writer.cpp Writer.h, lld/trunk/test/COFF output-chars.test crt-chars.test

COFF: Use (name, output characteristics) as a key when grouping input sections into output 
sections.

This is what link.exe does and lets us avoid needing to worry about
merging output characteristics while adding input sections to output
sections.

With this change we can't process /merge in the same way as before
because sections with different output characteristics can still
be merged into one another. So this change moves the processing of
/merge to just before we assign addresses. In the case where there
are multiple output sections with the same name, link.exe only merges
the first section with the source name into the first section with
the target name, and we do the same.

At the same time I also implemented transitive merging (which means
that /merge:.c=.b /merge:.b=.a merges both .c and .b into .a).

This isn't quite enough though because link.exe has a special case for
.CRT in 32-bit mode: it processes sections whose output characteristics
are DATA | R | W as though the output characteristics were DATA | R
(so that they get merged into things like constructor lists in the
expected way). Chromium has a few such sections, and it turns out
that those sections were causing the problem that resulted in r318699
(merge .xdata into .rdata) being reverted: because of the previous

    [9 lines not shown]

LLVM/llvm 330478llvm/trunk/test/tools/llvm-objcopy armexidx-link.test dynsym-error-remove-strtab.test, llvm/trunk/tools/llvm-objcopy Object.h Object.cpp

[llvm-objcopy] Fix sh_link

This diff fixes sh_link for various types of sections 
(i.e. for SHT_ARM_EXIDX, SHT_HASH). In particular, this change enables us
to use llvm-objcopy with clang -gsplit-dwarf for the target android-arm.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D45851

LLVM/llvm 330477openmp/trunk/libomptarget/deviceRTLs/nvptx CMakeLists.txt

[OpenMP] Make bc file compilation sensitive to LIBOMPTARGET_NVPTX_DEBUG flag

Summary: The LIBOMPTARGET_NVPTX_DEBUG flag is inconsistent between using nvcc to generate 
.a file and clang to generate .bc file. Sync the two setting so we can get debug messages 
from the bc file path as well.

Reviewers: grokos

Subscribers: Hahnfeld, openmp-commits, mgorny

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D45530

LLVM/llvm 330476compiler-rt/trunk/lib/sanitizer_common sanitizer_printf.cc, compiler-rt/trunk/lib/sanitizer_common/tests sanitizer_printf_test.cc

Revert "[Sanitizer] Internal Printf string precision argument + padding."

This reverts commit r330458.

There are existing code using string precision as 'max len', need more
work.

LLVM/llvm 330475llvm/trunk/lib/Transforms/Instrumentation HWAddressSanitizer.cpp, llvm/trunk/test/Instrumentation/HWAddressSanitizer basic.ll alloca.ll

[HWASan] Introduce non-zero based and dynamic shadow memory (LLVM).

Summary:
Support the dynamic shadow memory offset (the default case for user
space now) and static non-zero shadow memory offset
(-hwasan-mapping-offset option). Keeping the the latter case around
for functionality and performance comparison tests (and mostly for
-hwasan-mapping-offset=0 case).

The implementation is stripped down ASan one, picking only the relevant
parts in the following assumptions: shadow scale is fixed, the shadow
memory is dynamic, it is accessed via ifunc global, shadow memory address
rematerialization is suppressed.

Keep zero-based shadow memory for kernel (-hwasan-kernel option) and
calls instreumented case (-hwasan-instrument-with-calls option), which
essentially means that the generated code is not changed in these cases.

Reviewers: eugenis

Subscribers: srhines, llvm-commits

Differential Revision: https://reviews.llvm.org/D45840

LLVM/llvm 330474compiler-rt/trunk/lib/hwasan hwasan_linux.cc hwasan_dynamic_shadow.cc

[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).

Summary:
Retire the fixed shadow memory mapping to avoid conflicts with default
process memory mapping (currently manifests on Android).

Tests on AArch64 show <1% performance loss and code size increase,
making it possible to use dynamic shadow memory by default.

For the simplicity and unifirmity sake, use dynamic shadow memory mapping
with base address accessed via ifunc resolver on all supported platforms.

Keep the fixed shadow memory mapping around to be able to run
performance comparison tests later.

Complementing D45840.

Reviewers: eugenis

Subscribers: srhines, kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, 
llvm-commits

Differential Revision: https://reviews.llvm.org/D45847

LLVM/llvm 330473llvm/trunk/lib/Transforms/IPO PartialInlining.cpp, llvm/trunk/test/Transforms/CodeExtractor PartialInlineORECrash.ll

[PartialInlining] Fix Crash from holding a reference to a destructed ORE.

The callback used to create an ORE for the legacy PI pass caches the allocated
object in a unique_ptr in the runOnModule function, and returns a reference to
that object. Under certian circumstances we can end up holding onto that
reference after the OREs destruction. Rather then allowing the new and legacy
passes to create ORE object in diffrent ways, create the ORE at the point of
use.

Differential Revision: https://reviews.llvm.org/D43219

LLVM/llvm 330472llvm/trunk/lib/Target/Hexagon HexagonTargetTransformInfo.cpp

[Hexagon] hexagon-autohvx was left on again

LLVM/llvm 330471llvm/trunk/lib/Target/Hexagon HexagonPatternsHVX.td HexagonISelDAGToDAGHVX.cpp, llvm/trunk/test/CodeGen/Hexagon/autohvx isel-bitcast-vsplat.ll isel-bitcast-vsplat2.ll

[Hexagon] Improve HVX instruction selection (bitcast, vsplat)

There was some unfortunate interaction between VSPLAT and BITCAST
related to the selection of constant vectors (coming from selecting
shuffles). Introduce VSPLATW that always splats a 32-bit word, and
can have arbitrary result type (to avoid BITCASTs of VSPLAT).
Clean up the previous selection of BITCAST/VSPLAT.

LLVM/llvm 330470llvm/trunk/include/llvm/CodeGen TargetLoweringObjectFileImpl.h, llvm/trunk/include/llvm/Target TargetLoweringObjectFile.h

Remove unused argument from emitModuleMetadata.

NFCI.

LLVM/llvm 330469compiler-rt/trunk/test/asan/TestCases printf-4.c

asan: Mark printf-4.c as unsupported on Windows.

Although sprintf is not intercepted on Windows, this test can pass
if sprintf calls memmove, which is intercepted, so we can't XFAIL it.

Differential Revision: https://reviews.llvm.org/D45894

LLVM/llvm 330468llvm/trunk/lib/Target/Hexagon HexagonConstExtenders.cpp, llvm/trunk/test/CodeGen/Hexagon cext-opt-negative-fi.mir

[Hexagon] Skip fixed-stack indexes in HexagonConstExtenders

Fixed slots have negative values, and TRI::stackSlot2Index and
TRI::index2StackSlot do not handle negative numbers.

LLVM/llvm 330467polly/trunk/lib/External/isl/include/isl isl-noexceptions.h

[isl++] abort() on assertion violation.

Before this patch, ISL_ASSERT only printed an error message to stderr.
This can be easily missed if the program continues or just fails later.
To fail-early and help error diagnostics (e.g. using bugpoint), call
abort() when an assertion does not hold.

I seem to just have forgotten to add this abort() when I originally
proposed the ISL_ASSERT macro.

Suggested-By: Eli Friedman <efriedma at codeaurora.org>

Differential Revision: https://reviews.llvm.org/D45171

LLVM/llvm 330466polly/trunk/include/polly/Support ScopHelper.h, polly/trunk/lib/Analysis ScopDetection.cpp ScopInfo.cpp

Allow arbitrary function calls for debugging purposes.

Add the switch -polly-debug-func to define the name of a debug
function. This function is ignored for any validity check.

Its purpose is to allow to observe a value after transformation by a
SCoP, and to follow which statements are executed in which order. For
instance, consider the following code:

    static void dbg_printf(int sum, int i) {
      fprintf(stderr, "The value of sum is %d, i=%d\n", sum, i);
      fflush(stderr);
    }

    void func(int n) {
      int sum = 0;
      for (int i = 0; i < 16; i+=1) {
        sum += i;
        dbg_printf(sum, i);
      }
    }

Executing this after Polly's codegen with -polly-debug-func=dbg_printf
reveals the new execution order and the assumed values at that point of
execution.

    [2 lines not shown]

LLVM/llvm 330465llvm/trunk/lib/Target/X86 X86SchedSandyBridge.td

[X86][SandyBridge] Remove duplciate InstRWs from Sandy Brige scheduler model.

LLVM/llvm 330464lld/trunk/test/ELF warn-backrefs.s

Under some scenarios, the current directory isn't writable
during a test. Set the output path to avoid that problem.

LLVM/llvm 330463cfe/trunk/include/clang/Basic BuiltinsX86.def, cfe/trunk/lib/Basic/Targets X86.cpp

[X86] WaitPKG intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D45254

LLVM/llvm 330462llvm/trunk/lib/Target/X86 X86InstrInfo.td X86ISelLowering.cpp, llvm/trunk/lib/Target/X86/Disassembler X86DisassemblerDecoder.cpp

[X86] WaitPKG instructions

Three new instructions:

umonitor - Sets up a linear address range to be
monitored by hardware and activates the monitor.
The address range should be a writeback memory
caching type.

umwait - A hint that allows the processor to
stop instruction execution and enter an
implementation-dependent optimized state
until occurrence of a class of events.

tpause - Directs the processor to enter an
implementation-dependent optimized state
until the TSC reaches the value in EDX:EAX.

Also modifying the description of the mfence
instruction, as the rep prefix (0xF3) was allowed
before, which would conflict with umonitor during
disassembly.

Before:
$ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble

    [13 lines not shown]

LLVM/llvm 330461lld/trunk/COFF PDB.cpp

[LLD/PDB] Remove improper assert.

It's possible to have an empty object file, for example if you
just compile an empty .c file.  This file won't have any sections
so asserting that a file has chunks is definitely wrong.

LLVM/llvm 330460lldb/trunk/lldb.xcodeproj project.pbxproj

Fix the Xcode gtest target for the move of FileSpecTest.cpp.

LLVM/llvm 330459llvm/trunk/lib/Target/AArch64 AArch64InstrInfo.cpp, llvm/trunk/test/CodeGen/AArch64 machine-outliner.ll

[MachineOutliner] Change B instruction for tail calls to TCRETURNdi

First off, this is more correct than having the B. Second off, this was making
a bot upset. This fixes that.

Update the test to include -verify-machineinstrs as well to prevent stuff like
this slipping by non debug/assert builds in the future.

LLVM/llvm 330458compiler-rt/trunk/lib/sanitizer_common sanitizer_printf.cc, compiler-rt/trunk/lib/sanitizer_common/tests sanitizer_printf_test.cc

[Sanitizer] Internal Printf string precision argument + padding.

Summary:
Example:
  Printf("%.*s", 5, "123");
should yield:
  '123  '

In case Printf's requested string precision is larger than the string
argument, the resulting string should be padded up to the requested
precision.

For the simplicity sake, implementing right padding only.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D45844

LLVM/llvm 330457lld/trunk/COFF PDB.cpp, lld/trunk/test/COFF pdb.test

[LLD/PDB] Emit first section contribution for DBI Module Descriptor.

Part of the DBI stream is a list of variable length structures
describing each module that contributes to the final executable.

One member of this structure is a section contribution entry that
describes the first section contribution in the output file for
the given module.

We have been leaving this structure unpopulated until now, so with
this patch it is now filled out correctly.

Differential Revision: https://reviews.llvm.org/D45832

LLVM/llvm 330456lld/trunk/test/wasm gc-sections.ll, lld/trunk/test/wasm/Inputs globals.yaml

[WebAssembly] Implement -print-gc-sections, to better test GC of globals

Differential Revision: https://reviews.llvm.org/D44311

LLVM/llvm 330455llvm/trunk/utils/llvm-build/llvmbuild configutil.py main.py

Remove llvm-build's --configure-target-def-file.

It was added 6.5 years ago in r144345, but was never hooked up and has been
unused since.  If _you_ do use this, feel free to revert, but add a comment
on where it's used.

https://reviews.llvm.org/D45262

LLVM/llvm 330454lld/trunk/test/wasm gc-imports.ll, lld/trunk/test/wasm/Inputs undefined-globals.yaml

[WebAssembly] Implement GC for imports

Differential Revision: https://reviews.llvm.org/D44313