Commit graph

491 commits

Author SHA1 Message Date
Johan Engelen
fa59564e9f Fix naming in testcase. 2016-07-10 11:00:36 +02:00
Johan Engelen
57b21d10d4 Fix github issue 1611 2016-07-10 00:42:00 +02:00
Martin
e99f851e92 dmd-testsuite: Add test for issue #1335 2016-07-04 23:31:13 +02:00
David Nadlinger
75e1573cb2 Merge pull request #1577 from JohanEngelen/inlining
Implement cross-module inlining
2016-07-04 21:32:28 +01:00
Martin
12ff7ef803 Let special __result variable be an alias for sret
So for functions using sret and featuring an out contract, we save an
additional alloca + memcpy by using the sret pointer as storage.
2016-07-04 19:47:55 +02:00
Johan Engelen
3502eb8ddb Remove whitespace 2016-07-03 21:53:16 +02:00
Martin
ed70c12b06 Enable in-place construction for static array literals 2016-07-03 00:23:08 +02:00
Martin
08fa2f093c Enable in-place construction for struct literals 2016-07-03 00:23:03 +02:00
Johan Engelen
7919805eb4 Disable cross-module inlining for LLVM < 3.7. 2016-07-02 17:08:48 +02:00
Johan Engelen
ed7399a694 Add tests for inlining with static variables involved. 2016-07-02 17:08:48 +02:00
Johan Engelen
4169efad45 Fix inlining tests on Windows 2016-07-02 17:08:48 +02:00
Johan Engelen
7ed5a09dc3 Fixes and improvements to cross-module inlining code. 2016-07-02 17:08:48 +02:00
Johan Engelen
a3f0678283 Fix inlining problem: reverse order in which module array is codegenned. 2016-07-02 17:08:48 +02:00
Johan Engelen
2e9b196c09 Force codegen for templated functions with pragma(inline, true) 2016-07-02 17:08:47 +02:00
Johan Engelen
0eb8689006 Implement cross-module inlining (with and without pragma). 2016-07-02 17:08:47 +02:00
Johan Engelen
b8048be6e4 Implement same-module pragma(inline, {true|false}). 2016-07-02 17:08:47 +02:00
Martin
879fb97d56 Rename retvar to sretPointer 2016-07-02 12:52:21 +02:00
Martin
b12854df57 dmd-testsuite: Add test for issue #1450 2016-07-01 00:30:12 +02:00
Johan Engelen
e216b1180d Merge 2.071.1 (relative to 2.071.1-b2, only Phobos and dmd-testsuite changed) 2016-06-30 11:24:47 +02:00
David Nadlinger
17a64c2a54 Add test case for GitHub #1581 2016-06-27 17:16:21 +01:00
Martin
df5f52f3af dmd-testsuite: Add test for issue #1327 2016-06-26 21:50:06 +02:00
Martin
999cd37642 dmd-testsuite: Add test for issue #1548 2016-06-26 18:29:08 +02:00
Kai Nacke
267f404640 Add test case for: Add new extern(C++, class) and extern(C++, struct) declarations. 2016-06-25 20:20:39 +02:00
David Nadlinger
24048025c7 gen/statements: Always create new "after return" block for unreachable code
This makes sure we do not emit IR into the return bb after the terminator
instruction, which is invalid.

Also improved variable names and comments for clarity.

GitHub: Fixes #1582.
2016-06-25 00:27:18 +01:00
Johan Engelen
c7e0486205 Add IR-to-Objectcode caching with -ir2obj-cache=<cache dir>. 2016-06-23 19:48:59 +02:00
David Nadlinger
94fe1a6dc8 Merge pull request #1219 from JohanEngelen/pgo
Profile-guided optimizations (PGO)
2016-06-20 21:53:13 +01:00
Martin
db6f562fe8 Update druntime (Solaris) and dmd-testsuite (issue #953) 2016-06-20 20:25:04 +02:00
Johan Engelen
176961f325 [PGO] Fix tests on Win x86. Add testcase for extern(C++) function passed as template alias parameter. 2016-06-20 17:38:28 +02:00
Johan Engelen
c42e543424 [PGO] If a function is in a comdat group, set the linkage of __profn_ symbol to internal.
Attempt to fix PGO on Windows platform.
2016-06-20 17:28:27 +02:00
Johan Engelen
5ac4832e91 [PGO] Emit profile summary for LLVM >= 3.9 2016-06-20 17:28:27 +02:00
Johan Engelen
81fe81eec3 [PGO] Add test for -singleobj compilation. 2016-06-20 17:28:26 +02:00
Johan Engelen
62896f8217 [PGO] Separate the statements involving exceptions from the other statements.
Because of the new MSVC EH, PGO is not yet implemented for try/catch/scope/finally on Windows.
2016-06-20 17:28:24 +02:00
Johan Engelen
ebbd2a38d0 [PGO] Remove hot/cold function marking from LDC, because LLVM >= 3.8 does this itself: http://reviews.llvm.org/D15245 . 2016-06-20 17:28:23 +02:00
Johan Engelen
e52ce7dba4 [PGO] Implement correct calculation of region execution count for break label; and continue label;. 2016-06-20 17:28:23 +02:00
Johan Engelen
e0d9c58443 [PGO] Add PGO to LDC. Supported for LLVM >= 3.7
Add the commandline options -fprofile-instr-generate[=filename] and -profile-instr-use=filename
-fprofile-instr-generate
-- Add instrumentation on branches, switches, and function entry; uses LLVM's InstrProf pass.
-- Link to profile runtime that writes instrumentation counters to a file.
-fprofile-instr-use
-- Read profile data from a file and apply branch weights to branches and switches, and annotate functions with entrycount in LLVM IR.
-- Functions with low or high entrycount are marked with 'cold' or 'inlinehint'.

The only statement type without PGO yet is "try-finally".

A new pragma, `pragma(LDC_profile_instr, [ true | false ])`, is added to selectively disable/enable instrumentation of functions (granularity = whole functions).

The runtime library ldc-profile-rt is a copy of LLVM compiler-rt lib/profile. It has to be exactly in-sync with the LLVM version, and thus we need a copy for each PGO-supported LLVM (>=3.7).
import ldc.profile for a D interface to ldc-profile-rt (for example to reset execution counts after a program startup phase).

The instrumentation data is mainly passed on to LLVM: function-entry counts and branch counts/probabilities. LDC marks functions as hot when "execution count is 30% of the maximum function execution count", and marks functions as cold if their count is 1% of maximum function execution count.

The source of LLVM's llvm-profdata tool is hereby included in LDCs repository (different source for each LLVM version), and the binary is included in the install bin folder.
The executable is named "ldc-profdata" to avoid clashing with llvm-profdata on the same machine. This is needed because profdata executable has to be in-sync with the LLVM version used to build LDC.

Maintenance burden: for trunk LLVM, we have to keep ldc-profile-rt and llvm-profdata in sync. There is no diff with upstream; but because of active development there are the occasional API changes.
2016-06-20 17:28:22 +02:00
Martin
fa3ea1c4a9 Add IR test for optimized array (in)equality with null 2016-06-18 17:42:02 +02:00
Johan Engelen
5856b5a283 [Lit] Give priority to LDC's version of LLVM tools: we need FileCheck with certain bug fixes 2016-06-12 12:49:22 +02:00
Johan Engelen
6863d92ba2 Target traits: disable test that depends on LLVM version. 2016-06-10 12:44:18 +02:00
Johan Engelen
404d483c2a Bitcode cmd arguments: fix compilation for LLVM < 3.8, and disable for LLVM 3.5. 2016-06-10 12:43:31 +02:00
Johan Engelen
d7ed918766 Fix codegen for static initialization with typeid(A). Resolves issue 1540. 2016-06-08 10:40:00 +02:00
Johan Engelen
5ffd34f7b6 Add LDC-specific traits for CTFE information about the target machine.
__traits(targetCPU) == "broadwell"
__traits(targetHasFeature, "sse2") == bool
2016-06-06 11:19:07 +02:00
Johan Engelen
d9b267a4be Accept LLVM bitcode files (*.bc) on the commandline and add the code to the first source file on the cmdline (the first emitted module). 2016-06-05 16:07:14 +02:00
Johan Engelen
72d20ce21c Fix LDC ICE for https://issues.dlang.org/show_bug.cgi?id=16022.
Added additional test case with enum structs.
2016-06-02 10:30:27 +02:00
Johan Engelen
53106f294d Merge branch 'master' into merge-2.071 2016-06-01 18:28:36 +02:00
Johan Engelen
28487120dc Merge DMD tag 'v2.071.1-b2' 2016-05-30 11:08:00 +02:00
Johan Engelen
04b89e642c Windows: Move the prepending of 0x1 to C++ mangled functions from frontend to the backend.
Windows x64 ABI: remove unnecessary \01 from mangled symbol name.

This removes the 0x1 byte from `.mangleof` accessible from user code.
Resolves issue #1519

Also let mangleForLLVM take a std::string, to enable C++11's moves.
2016-05-30 10:18:39 +02:00
David Nadlinger
fd53009f87 Merge pull request #1526 from JohanEngelen/simdunaligned
SIMD: Fix loadUnaligned for newer LLVM types and add storeUnaligned.
2016-05-28 15:44:45 +01:00
Johan Engelen
2e6740842f SIMD: Fix loadUnaligned for newer LLVM types and add storeUnaligned.
Resolves issue #1518. Combines druntime patches from Martin Novak and Ilya Yaroshenko.
2016-05-28 01:01:48 +02:00
Johan Engelen
e50f15af7f Tests: use -mtriple= instead of without equals sign. 2016-05-27 23:49:56 +02:00
Johan Engelen
0a765ade47 Mark alignment test as expected failure on Windows x86, due to issue #1356. 2016-05-24 22:13:53 +02:00