Commit Graph

4366 Commits

Author SHA1 Message Date
Coby Tayree d5e7410dca revert rL314300
accidently added only tests w/o the respective changes..

llvm-svn: 314302
2017-09-27 13:02:44 +00:00
Coby Tayree 0b1ed7e19a [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions
Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized.
supersedes D33277, D35775
Corrsponds with D37412, D37413

llvm-svn: 314300
2017-09-27 12:36:54 +00:00
Saleem Abdulrasool 4d321336d0 Basic: support Preserve{Most,All} CC on Windows
Add support for the `preserve_mostcc` and `preserve_allcc` on Windows
x86_64 and AArch64.  This is used by Swift.

llvm-svn: 314236
2017-09-26 19:26:01 +00:00
Artem Belevich bab95c7087 [NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.
Differential Revision: https://reviews.llvm.org/D38191

llvm-svn: 314223
2017-09-26 17:07:23 +00:00
Ivan A. Kosarev b75a50b121 Fix TBAA information for reference accesses
This patch fixes clang to decorate reference accesses as pointers
and not as "omnipotent chars".

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

llvm-svn: 314209
2017-09-26 14:22:48 +00:00
Vlad Tsyrklevich 2eccdab308 Allow specifying sanitizers in blacklists
Summary:
This is the follow-up patch to D37924.

This change refactors clang to use the the newly added section headers
in SpecialCaseList to specify which sanitizers blacklists entries
should apply to, like so:

  [cfi-vcall]
  fun:*bad_vcall*
  [cfi-derived-cast|cfi-unrelated-cast]
  fun:*bad_cast*

The SanitizerSpecialCaseList class has been added to allow querying by
SanitizerMask, and SanitizerBlacklist and its downstream users have been
updated to provide that information. Old blacklists not using sections
will continue to function identically since the blacklist entries will
be placed into a '[*]' section by default matching against all
sanitizers.

Reviewers: pcc, kcc, eugenis, vsk

Reviewed By: eugenis

Subscribers: dberris, cfe-commits, mgorny

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

llvm-svn: 314171
2017-09-25 22:11:12 +00:00
Sanjay Patel d386336441 [x86] make assertions less strict in avx512f test file
Missed a line in r314158.

llvm-svn: 314159
2017-09-25 21:31:08 +00:00
Sanjay Patel 0433194e55 [x86] make assertions less strict in avx512f test file
I'm not sure why yet, but there may be differences depending on the host?

llvm-svn: 314158
2017-09-25 21:27:37 +00:00
Sanjay Patel 1acd2cf15a [x86] remove RUNs that were checking fully optimized IR
Clang regression tests that depend on the optimizer can break
when there are changes to LLVM...as in: 
https://reviews.llvm.org/rL314117

llvm-svn: 314144
2017-09-25 19:56:57 +00:00
Justin Lebar d31d5e6aa2 Revert "[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.", rL314135.
Causing assertion failures on macos:

> Assertion failed: (Num < NumOperands && "Invalid child # of SDNode!"),
> function getOperand, file
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm/include/llvm/CodeGen/SelectionDAGNodes.h,
> line 835.

http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42739/testReport/LLVM/CodeGen_NVPTX/surf_read_cuda_ll/

llvm-svn: 314142
2017-09-25 19:41:56 +00:00
Artem Belevich 9941ee9529 [NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.
Differential Revision: https://reviews.llvm.org/D38191

llvm-svn: 314135
2017-09-25 18:53:57 +00:00
Jina Nahias 123c599a0f fixing a bug in mask[z]_set1 intrinsic
Differential Revision: https://reviews.llvm.org/D38231

Change-Id: I80bbff9cbe93e4be54d8a761ef9723edf3f57c57
llvm-svn: 314102
2017-09-25 13:38:08 +00:00
Akira Hatanaka 34b5dbca0a Promote storage-only __fp16 vector operands to float vectors.
This commit fixes a bug in the handling of storage-only __fp16 vectors
where clang didn't promote __fp16 vector operands to float vectors.

Conceptually, it performs the following transformation on the AST in
CreateBuiltinBinOp and CreateBuiltinUnaryOp:

(Before)
  typedef __fp16 half4 __attribute__ ((vector_size (8)));
  typedef float float4 __attribute__ ((vector_size (16)));
  half4 hv0, hv1, hv2, hv3;

  hv0 = hv1 + hv2 + hv3;

(After)
  float4 t0 = (float4)hv1 + (float4)hv2;
  float4 t1 = t0 + (float4)hv3;
  hv0 = (half4)t1;

Note that this commit fixes the bug for targets that set
HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics
such as llvm.convert.to.fp16 to handle __fp16 are still broken.

rdar://problem/20625184

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

llvm-svn: 314056
2017-09-23 05:02:02 +00:00
Akira Hatanaka ba0367a708 [CodeGen][ObjC] Build the global block structure before emitting the
body of global block invoke functions.

This commit fixes an infinite loop in IRGen that occurs when compiling
the following code:

void FUNC2() {
  static void (^const block1)(int) = ^(int a){
    if (a--)
      block1(a);
  };
}

This is how IRGen gets stuck in the infinite loop:

1. GenerateBlockFunction is called to emit the body of "block1".

2. GetAddrOfGlobalBlock is called to get the address of "block1". The
   function calls getAddrOfGlobalBlockIfEmitted to check whether the
   global block has been emitted. If it hasn't been emitted, it then
   tries to emit the body of the block function by calling
   GenerateBlockFunction, which goes back to step 1.

This commit prevents the inifinite loop by building the global block in
GenerateBlockFunction before emitting the body of the block function.

rdar://problem/34541684

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

llvm-svn: 314029
2017-09-22 21:32:06 +00:00
Artem Belevich 42960b4188 [NVPTX] Implemented bar.warp.sync, barrier.sync, and vote{.sync} instructions/intrinsics/builtins.
Differential Revision: https://reviews.llvm.org/D38148

llvm-svn: 313898
2017-09-21 18:44:49 +00:00
Artem Belevich 4654dc89be [NVPTX] Implemented shfl.sync instruction and supporting intrinsics/builtins.
Differential Revision: https://reviews.llvm.org/D38090

llvm-svn: 313820
2017-09-20 21:23:07 +00:00
Andrew Kaylor b9be53634c Remove offset size check in nullptr arithmetic handling
Differential Revision: https://reviews.llvm.org/D37042

llvm-svn: 313784
2017-09-20 18:06:44 +00:00
Andrew Kaylor 21a2aa7203 Fix 32-bit buildbots by removing tests that are dependent on pointer-size comparisons.
The recently behavior in the code that these tests were meant to be checking will be ammended as soon as a suitable change can be properly reviewed.

llvm-svn: 313684
2017-09-19 21:43:01 +00:00
Andrew Kaylor 3d0a540857 Teach clang to tolerate the 'p = nullptr + n' idiom used by glibc
Differential Revision: https://reviews.llvm.org/D37042

llvm-svn: 313666
2017-09-19 20:26:40 +00:00
Jina Nahias 3ad702a1ed Lowering Mask Set1 intrinsics to LLVM IR
This patch, together with a matching llvm patch (https://reviews.llvm.org/D37669), implements the lowering of X86 mask set1 intrinsics to IR.

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

llvm-svn: 313624
2017-09-19 11:00:27 +00:00
Heejin Ahn b29a17ba21 [WebAssembly] Restore __builtin_wasm_rethrow builtin
Summary:
Restore the `__builtin_wasm_rethrow` builtin deleted in D37931. On second
thought, it appears it can be used to implement `__cxa_rethrow`.

Reviewers: dschuff, sunfish

Reviewed By: dschuff

Subscribers: jfb, sbc100, jgravelle-google

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

llvm-svn: 313430
2017-09-16 01:07:43 +00:00
Craig Topper 8cd7b0cd2c [X86] Use native shuffle vector for the perm2f128 intrinsics
This patch replaces the perm2f128 intrinsics with native shuffle vectors.

This uses a pretty simple approach to allocate source 0 to the lower half input and source 1 to the upper half input. Then its just a matter of filling in the indices to use either the lower or upper half of that specific source. This can result in the same source being used by both operands. InstCombine or SelectionDAGBuilder should be able to clean that up.

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

llvm-svn: 313418
2017-09-15 23:00:59 +00:00
Heejin Ahn fa9e1fba8c Remove __builtin_wasm_rethrow builtin
Summary:
Remove `__builtin_wasm_rethrow` builtin. I thought it was required to implement
`__cxa_rethrow` function in libcxxabi, but it turned out it will be using
`__builtin_wasm_throw` instead.

Reviewers: dschuff, jgravelle-google

Reviewed By: jgravelle-google

Subscribers: jfb, sbc100, jgravelle-google

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

llvm-svn: 313402
2017-09-15 22:01:22 +00:00
Craig Topper 04370d3a82 [X86] Disable _mm512_maskz_set1_epi64 intrinsic on 32-bit targets to prevent a backend isel failure.
The __builtin_ia32_pbroadcastq512_mem_mask we were previously trying to use in 32-bit mode is not implemented in the x86 backend and causes isel to fail in release builds. In debug builds it fails even earlier during legalization with an llvm_unreachable.

While there add the missing test case for this intrinsic for this for 64-bit mode.

This fixes PR34631. D37668 should be able to recover this for 32-bit mode soon. But I wanted to fix the crash ahead of that.

llvm-svn: 313392
2017-09-15 20:27:59 +00:00
Uriel Korach 3fba3c3b0c [X86] [PATCH] [intrinsics] Lowering X86 ABS intrinsics to IR. (clang)
This patch, together with a matching llvm patch (https://reviews.llvm.org/D37693), implements the lowering of X86 ABS intrinsics to IR.

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

llvm-svn: 313133
2017-09-13 09:02:02 +00:00
Simon Pilgrim 14fd10e528 Fix PR34021 test on non-x86 build targets
llvm-svn: 313034
2017-09-12 15:04:04 +00:00
Simon Pilgrim 403fd9d636 Limit test to x86 targets
llvm-svn: 313024
2017-09-12 12:16:35 +00:00
Simon Pilgrim bbef124ea3 [MS-InlineAsm] Fix cast assertion with vector spills (PR34021)
Differential Revision: https://reviews.llvm.org/D37448

llvm-svn: 313019
2017-09-12 11:05:42 +00:00
Yael Tsafrir 23e7733230 [X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR
Differential Revision: https://reviews.llvm.org/D37562

llvm-svn: 313011
2017-09-12 07:46:32 +00:00
Benjamin Kramer 1a48ddb864 Fixing incorrectly capitalised regexps.
Patch by Sam Allen!

llvm-svn: 312710
2017-09-07 09:54:03 +00:00
Karl-Johan Karlsson 32e5273491 Corrected testcase to work with release build
The fault was introduced in r312623

llvm-svn: 312627
2017-09-06 10:12:32 +00:00
Karl-Johan Karlsson 33e205a40f Debug info: Fixed faulty debug locations for attributed statements
Summary:
As the attributed statements are considered simple statements no
stoppoint was generated before emitting attributed do/while/for/range-
statement. This lead to faulty debug locations.

Reviewers: echristo, aaron.ballman, dblaikie

Reviewed By: dblaikie

Subscribers: bjope, aprantl, cfe-commits

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

llvm-svn: 312623
2017-09-06 08:47:18 +00:00
Reid Kleckner d53c39ba46 Commit changes missing from r312572
llvm-svn: 312573
2017-09-05 20:38:29 +00:00
Reid Kleckner 30701edf76 [ms] Implement the __annotation intrinsic
llvm-svn: 312572
2017-09-05 20:27:35 +00:00
Simon Pilgrim 1ba2bf2162 [X86][AVX512] _mm512_stream_load_si512 should take a void const* argument (PR33977)
Based off the Intel Intrinsics guide, we should expect a void const* argument.

Prevents 'passing 'const void *' to parameter of type 'void *' discards qualifiers' warnings.

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

llvm-svn: 312523
2017-09-05 10:06:41 +00:00
Hal Finkel c9fac9e151 [CodeGen] Treat all vector fields as mayalias
Because it is common to treat vector types as an array of their elements, or
even some other type that's not the element type, and thus index into them, we
can't use struct-path TBAA for these accesses. Even though we already treat all
vector types as equivalent to 'char', we were using field-offset information
for them with TBAA, and this renders undefined the intra-value indexing we
intend to allow. Note that, although 'char' is universally aliasing, with path
TBAA, we can still differentiate between access to s.a and s.b in
  struct { char a, b; } s;. We can't use this capability as-is for vector types.

Fixes PR33967.

llvm-svn: 312447
2017-09-03 17:18:25 +00:00
Hans Wennborg 8f1559c238 Fix the test fix from r312181
llvm-svn: 312193
2017-08-30 23:26:38 +00:00
Douglas Yung aa25e5bab2 Fix tests for ARM targets
Tests fail on ARM targets due to ABI name between define and void. Added reg ex to skip.

Patch by Glenn Howe (and expanded on by Douglas Yung)!

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

llvm-svn: 312181
2017-08-30 22:30:08 +00:00
Erich Keane bb9c704784 [CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64
This attribute is useful in OS development when we jump from 32 to 64 bit
code and expect that 64bit function forces correct stack alignment.

Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html

Patch By: anatol.pomozov (anatol.pomozov@gmail.com)

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

llvm-svn: 312173
2017-08-30 21:17:40 +00:00
Adrian Prantl 9e83fb0838 Adapt testcases to LLVM change r312144 in DIGlobalVariableExpression
llvm-svn: 312148
2017-08-30 18:22:23 +00:00
Craig Topper 5ece4cfe1e [X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflevector instead builtins
This patch implements the broadcastf32x2/broadcasti32x2 intrinsics using __builtin_shufflevector.

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

llvm-svn: 312135
2017-08-30 16:15:12 +00:00
Evgeniy Stepanov 6d2b6f0a5f Minimal runtime for UBSan.
Summary:
An implementation of ubsan runtime library suitable for use in production.

Minimal attack surface.
* No stack traces.
* Definitely no C++ demangling.
* No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general.
* as simple as possible

Minimal CPU and RAM overhead.
* Source locations unnecessary in the presence of (split) debug info.
* Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at.
* above two items save 3% binary size.

When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt.

Reviewers: pcc, kcc

Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits

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

llvm-svn: 312029
2017-08-29 20:03:51 +00:00
Craig Topper 2c03e53f4e [X86] Add support for __builtin_cpu_init
This adds builtin_cpu_init which will emit a call to cpu_indicator_init in libgcc or compiler-rt.

This is needed to support builtin_cpu_supports/builtin_cpu_is in an ifunc resolver.

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

llvm-svn: 311874
2017-08-28 05:43:23 +00:00
Dehao Chen 5e97f23441 Expose -mllvm -accurate-sample-profile to clang.
Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20%

Reviewers: davidxl, rsmith

Reviewed By: davidxl, rsmith

Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits

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

llvm-svn: 311707
2017-08-24 21:37:33 +00:00
Coby Tayree 7b49dc9c68 [Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints
This patch is intended to enable the use of basic double letter constraints used in GCC extended inline asm {Yi Y2 Yz Y0 Ym Yt}.
Supersedes D35205
llvm counterpart: D36369

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

llvm-svn: 311643
2017-08-24 09:07:34 +00:00
Coby Tayree cfa3810aa0 Fixups to FE tests affected by D36793
Differential Revision: https://reviews.llvm.org/D36794

llvm-svn: 311640
2017-08-24 08:47:26 +00:00
Reid Kleckner 6d353348e5 Parse and print DIExpressions inline to ease IR and MIR testing
Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

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

llvm-svn: 311594
2017-08-23 20:31:27 +00:00
Taewook Oh 0fb5b78892 Use the file name from linemarker for debug info if an input is preprocessed source.
Summary:
Even in the case of the input file is a preprocessed source, clang uses the file name of the preprocesses source for debug info (DW_AT_name attribute for DW_TAG_compile_unit). However, gcc uses the file name specified in the first linemarker instead. This makes more sense because the one specified in the linemarker represents the "actual" source file name.

Clang already uses the file name specified in the first linemarker for Module name (https://github.com/llvm-mirror/clang/blob/master/lib/Frontend/FrontendAction.cpp#L779) if the input is preprocessed. This patch makes clang to use the same value for debug info as well.

Reviewers: compnerd, rnk, dblaikie, rsmith

Reviewed By: rnk

Subscribers: aprantl, cfe-commits

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

llvm-svn: 311037
2017-08-16 19:36:24 +00:00
Stefan Maksimovic ac642ae7c0 Revert r302670 for the upcoming 5.0.0 release
This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.

Faliures manifest for stage2 mips build.

llvm-svn: 310704
2017-08-11 11:39:07 +00:00
Stefan Maksimovic 76391b101d Revert r310057
Bring back changes which r304953 introduced since
they were in fact not the cause of failures described
in r310057 commit message.

llvm-svn: 310702
2017-08-11 11:03:54 +00:00