Commit Graph

2828 Commits

Author SHA1 Message Date
Craig Topper 4cac1c2318 [X86] Add AVX512F integer comparision intrinsics to header file.
llvm-svn: 227067
2015-01-25 23:30:07 +00:00
Justin Bogner 9fa8c9984c test: Convert some tests to FileCheck
These were all doing trivial greps. It's better to use FileCheck.

llvm-svn: 227007
2015-01-24 17:39:36 +00:00
Justin Bogner 2af264a44a test: Remove two redundant lines from this test
The FileCheck already checks for these lines, no need to grep as well.

llvm-svn: 227006
2015-01-24 17:39:32 +00:00
Sanjay Patel 76c9e0986c Process the -fno-signed-zeros optimization flag (PR20870)
The driver currently accepts but ignores the -fno-signed-zeros flag. 
This patch passes the flag through and enables 'nsz' fast-math-flag 
generation in IR.

The existing OpenCL flag for the same functionality is made into an
alias here. It may be removed in a subsequent patch.

This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 );
patches for the optimizer were checked in at:
http://llvm.org/viewvc/llvm-project?view=revision&revision=225050
http://llvm.org/viewvc/llvm-project?view=revision&revision=224583

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

llvm-svn: 226915
2015-01-23 16:40:50 +00:00
Reid Kleckner 2a2e156318 SEH: Emit the constant filter 1 as a catch-all
Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766
2015-01-22 02:25:56 +00:00
Reid Kleckner 1d59f99f5c Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

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

llvm-svn: 226760
2015-01-22 01:36:17 +00:00
Rafael Espindola e855c2ae0a Revert "Try to fix -Asserts build bots."
This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759
2015-01-22 01:33:41 +00:00
Rafael Espindola b88c11281c Try to fix -Asserts build bots.
llvm-svn: 226758
2015-01-22 01:26:39 +00:00
Reid Kleckner 395dad8213 Give the block inlining test a triple to determinise output
It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757
2015-01-22 01:19:19 +00:00
Rafael Espindola e5df59ff78 Emit DeferredDeclsToEmit in a DFS order.
Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that.

The advantages of the change are that

* The output order is a bit closer to the source order. The change to
test/CodeGenCXX/pod-member-memcpys.cpp is a good example.

* If we decide to deffer more, it will not cause as large changes in the
estcases as it would without this patch.

llvm-svn: 226751
2015-01-22 00:24:57 +00:00
Adam Nemet f893edeaea [AVX512] Add sub-vector FP extracts
Analogous to AVX2, these need to be implemented as macros to properly
propagate the immediate index operand.

Part of <rdar://problem/17688758>

llvm-svn: 226496
2015-01-19 20:12:05 +00:00
Adrian Prantl 7c6f944cdf Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
with a DW_OP_deref instead.

llvm-svn: 226474
2015-01-19 17:51:58 +00:00
Craig Topper f557b09f14 [x86] Mark that the AVX-512 cmpps/cmppd builtins need an ICE for the comparison immediate. This requires converting to a macro in the header file.
llvm-svn: 226421
2015-01-19 01:18:19 +00:00
Eric Christopher 49b425d9d2 Remove pathname dependence. Also rewrite test to use FileCheck
at the same time.

Patch by David Callahan.

llvm-svn: 226331
2015-01-16 22:03:52 +00:00
Rafael Espindola d9b26d563a Add comdat to string literal variables on COFF.
llvm-svn: 226317
2015-01-16 20:32:35 +00:00
Adam Nemet c0cff244fc [AVX512] Add intrinsics for masked aligned FP loads and stores
Part of <rdar://problem/17688758>

llvm-svn: 226298
2015-01-16 18:51:50 +00:00
Adam Nemet d47dec4690 Fix typo in r225922.
llvm-svn: 226297
2015-01-16 18:51:46 +00:00
Duncan P. N. Exon Smith 8d3ef611ce IR: Move MDLocation into place (clang testcases)
Update testcases to match LLVM change in r226048.

llvm-svn: 226049
2015-01-14 22:28:03 +00:00
Daniel Sanders 998c910262 [mips] Handle transparent unions correctly.
Summary:
This fixes MultiSource/Applications/lemon on big-endian N32 by correcting the
handling of the argument to wait(). glibc defines it as a transparent union of
void* and int*. Such unions are passed according to the rules of the first
member so the argument must be passed as if it were a void* (sign extended from
i32 to i64) and not as a union (shifted to the upper bits of an i64).

wait() already behaves correctly on big-endian O32 and N64 since the union is
already the same size as an argument slot.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 225981
2015-01-14 12:00:12 +00:00
Adam Nemet 63a951eb1c [AVX512] Add FP unpack intrinsics
These are implemented with __builtin_shufflevector just like AVX.

We have some tests on the LLVM side to assert that these shufflevectors do
indeed generate the corresponding unpck instruction.

Part of <rdar://problem/17688758>

llvm-svn: 225922
2015-01-14 01:31:17 +00:00
Daniel Sanders cdcb580d4e [mips] Fix va_arg() for pointer types on big-endian N32.
Summary:
The Mips ABI's treat pointers in the same way as integers. They are
sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter
for O32 and N64 where pointers are already the correct width but it does matter
for big-endian N32, where pointers are 32-bit and need promoting.

The caller side is already passing pointers correctly. This patch corrects the
callee.

Reviewers: vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 225782
2015-01-13 10:47:00 +00:00
Alexey Samsonov 8845952b54 Reimplement -fsanitize-recover family of flags.
Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719
2015-01-12 22:39:12 +00:00
Rafael Espindola 0d4fb98504 [patch][pr19848] Produce explicit comdats in clang.
The llvm IR until recently had no support for comdats. This was a problem when
targeting C++ on ELF/COFF as just using weak linkage would cause quite a bit of
dead bits to remain on the executable (unless -ffunction-sections,
-fdata-sections and --gc-sections were used).

To fix the problem, llvm's codegen will just assume that any weak or linkonce
that is not in an explicit comdat should be output in one with the same name as
the global.

This unfortunately breaks cases like pr19848 where a weak symbol is not
xpected to be part of any comdat.

Now that we have explicit comdats in the IR, we can finally get both cases
right.

This first patch just makes clang give explicit comdats to GlobalValues where
t is allowed to.

A followup patch to llvm will then stop implicitly producing comdats.

llvm-svn: 225705
2015-01-12 22:13:53 +00:00
David Majnemer f1fdf4a80c CodeGen: Simplify consecutive '%' modifiers
LLVM the consecutive '%' modifiers are redundant, skip them.

llvm-svn: 225602
2015-01-11 09:13:56 +00:00
David Majnemer 14d4e7bdbf CodeGen: Simplify consecutive '&' modifiers
LLVM the consecutive '&' modifiers are redundant, skip them.

llvm-svn: 225601
2015-01-11 09:09:01 +00:00
Duncan P. N. Exon Smith 4bbe428cc5 IR: Add 'distinct' MDNodes to bitcode and assembly (clang)
Update testcases for LLVM change in r225474 to make `MDNode`s explicitly
distinct (when they aren't uniqued).

Part of PR22111.

llvm-svn: 225475
2015-01-08 22:39:28 +00:00
Tom Stellard d8e38a3206 R600: Handle amdgcn triple
For now there is no difference between amdgcn and r600.

llvm-svn: 225294
2015-01-06 20:34:47 +00:00
David Blaikie b9a23c9155 DebugInfo: Provide a less subtle way to set the debug location of simple ret instructions
un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083.

llvm-svn: 225090
2015-01-02 22:07:26 +00:00
David Blaikie 5e9e13f54a Temporarily XFAIL fallout from r225083 while investigating.
Between this behavior and that fixed by r225083/r225000, I'll take the
latter over the former for now, but I'm immediately working on
understanding/addressing this behavior too.

(the fact that the code change in r225083 caused this change in behavior
is a bit troubling anyway - given that it looks & claims to be just a
preformance thing)

llvm-svn: 225086
2015-01-02 19:49:28 +00:00
Craig Topper 2094d8fe88 [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
2014-12-27 06:59:57 +00:00
David Majnemer fd4f63ad4b Adjust the rest of the tests due to r224849.
llvm-svn: 224865
2014-12-26 18:45:57 +00:00
David Majnemer ca7e485c3f Update tests due to r224849
Inferring nuw caused some clang tests to change their output.

llvm-svn: 224851
2014-12-26 10:29:40 +00:00
Nico Weber 4f477fbe57 Add a triple to try and get this test passing on the ARM bots.
llvm-svn: 224747
2014-12-23 01:07:10 +00:00
Nico Weber 08ef80f4b8 Rename test.cc files to test.cpp.
The lit.cfg files only add .cpp to suffixes, so these tests used to never run,
oops.  (Also tweak to of these tests in minor ways to make the actually pass.)

llvm-svn: 224718
2014-12-22 18:13:07 +00:00
Alexey Bataev 7cb1789011 Fix for PR21915: assert on multidimensional VLA in function arguments.
Fixed assertion on type checking for arguments and parameters on function call if arguments are pointers to VLA
Differential Revision: http://reviews.llvm.org/D6655

llvm-svn: 224504
2014-12-18 06:54:53 +00:00
Eric Christopher 560cc4fb44 Make sure that arm-linux-gnu is still the apcs-gnu ABI when we
use clang -cc1 matching the front end and backend. Fix up a couple
of tests that were testing aapcs for arm-linux-gnu.

The test that removes the aapcs abi calling convention removes
them because the default triple matches what the backend uses
for the calling convention there and so it doesn't need to be
explicitly stated - see the code in TargetInfo.cpp.

llvm-svn: 224491
2014-12-18 02:08:55 +00:00
Saleem Abdulrasool 86b881c63e CodeGen: implement __emit intrinsic
For MSVC compatibility, add the `__emit' builtin. This is used in the Windows
SDK headers, and must therefore be implemented as a builtin rather than an
intrinsic.

The `__emit' builtin provides a mechanism to emit a 16-bit opcode instruction
into the stream. The value must be a compile time constant expression. No
guarantees are made about the CPU and memory states after the execution of the
instruction.

Due to the unchecked nature of the builtin, only support this on Windows on ARM.

llvm-svn: 224438
2014-12-17 17:52:30 +00:00
Toma Tabacu 9941195a9f [mips] Always clobber $1 for MIPS inline asm.
Summary:
Because GCC doesn't use $1 for code generation, inline assembly code can use $1 without having to add it to the clobbers list.

LLVM, on the other hand, does not shy away from using $1, and this can cause conflicts with inline assembly which assumes GCC-like code generation.

A solution to this problem is to make Clang automatically clobber $1 for all MIPS inline assembly.
This is not the optimal solution, but it seems like a necessary compromise, for now.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: cfe-commits

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

llvm-svn: 224428
2014-12-17 12:02:58 +00:00
Adrian Prantl 98f1f27810 Update this testcase for the new metadata assembler syntax.
llvm-svn: 224262
2014-12-15 19:25:33 +00:00
Duncan P. N. Exon Smith b3a66691f8 IR: Make metadata typeless in assembly, clang side
Match LLVM changes from r224257.

llvm-svn: 224259
2014-12-15 19:10:08 +00:00
Alexey Bataev a47ae907e8 Fixed test/CodeGen/atomic_ops.c for compatibility with hexagon target
llvm-svn: 224231
2014-12-15 06:12:42 +00:00
Alexey Bataev 452d8e1133 Bugfix for Codegen of atomic load/store/other ops.
Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations.
Differential Revision: http://reviews.llvm.org/D6499

llvm-svn: 224230
2014-12-15 05:25:25 +00:00
David Majnemer ee8d04d8dd CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatile
Don't inherit the volatile-ness of the input pointer to the volatile
operation for memory allocated on the side.

This fixes PR17306.

llvm-svn: 224110
2014-12-12 08:16:09 +00:00
Paul Robinson 0855695159 Instead of having -Os/-Oz add OptimizeForSize/MinSize first, and later
having OptimizeNone remove them again, just don't add them in the
first place if the function already has OptimizeNone.

Note that MinSize can still appear due to attributes on different
declarations; a future patch will address that.

llvm-svn: 224047
2014-12-11 20:14:04 +00:00
Paul Robinson aae2fba540 Diagnose attributes 'optnone' and 'minsize' on the same declaration.
Eventually we'll diagnose them on different declarations, but let's
get this part out of the way first.

llvm-svn: 223985
2014-12-10 23:34:36 +00:00
Paul Robinson 621b6d3bf7 Revert r223980 as it had wrong commit message.
llvm-svn: 223984
2014-12-10 23:32:57 +00:00
Paul Robinson 2936851426 Rename a couple of preprocessor symbols to be more descriptive. NFC.
Review feedback from recent changes to GetSVN.cmake.

llvm-svn: 223980
2014-12-10 23:12:37 +00:00
Kostya Serebryany 597dcc7a8d No memcpy for copy ctor with -fsanitize-address-field-padding=1
Summary:
When -fsanitize-address-field-padding=1 is present
don't emit memcpy for copy constructor.
Thanks Nico for the extra test case.

Test Plan: regression tests

Reviewers: thakis, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 223563
2014-12-06 01:23:08 +00:00
Eric Christopher 0e2618857c Have the driver and the target code agree on what the default ABI
is for each machine. Fix up darwin tests that were testing for
aapcs on armv7-ios when the actual ABI is apcs.

Should be no user visible change without -cc1.

llvm-svn: 223429
2014-12-05 01:06:59 +00:00
Reid Kleckner 2c8d86ca05 Add test for __umulh
llvm-svn: 223319
2014-12-03 23:52:26 +00:00