Commit graph

106 commits

Author SHA1 Message Date
David Nadlinger
d8249bb2e1 Merge pull request #1737 from JohanEngelen/disablecross
Only enable cross-module inlining when explicitly set on the commandline.
2016-09-08 22:18:42 +01:00
Johan Engelen
4991bc0743 Fix LLVM 4.0 compile. 2016-09-04 14:40:39 +02:00
Johan Engelen
55a8097736 Only enable cross-module inlining when explicitly set on the commandline.
In particular, this disables cross-module inlining of `pragma(inline, true)` functions.
2016-09-04 11:38:12 +02:00
Johan Engelen
e95a8472d0 [PGO] For LLVM >= 3.9, let profile-rt set the default filename. This prevents extra stderr messages when overriding the filename using the "LLVM_PROFILE_FILE" environment variable. 2016-08-04 16:35:44 +02:00
Johan Engelen
7919805eb4 Disable cross-module inlining for LLVM < 3.7. 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
David Nadlinger
5858398ae2 optimizer: Skip adding verifier function pass if -disable-verify is given
This makes the flag useful again for dumping invalid IR.
2016-06-27 15:04:40 +01:00
David Nadlinger
a963e7439b optimizer: Mechanical cleanup [nfc] 2016-06-27 14:53:15 +01:00
David Nadlinger
fbce0be4e0 optimizer: clang-format again [nfc] 2016-06-27 14:45:56 +01:00
Johan Engelen
cb4b77d4d0 Fix LLVM3.9 build. 2016-06-20 17:28:29 +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
David Nadlinger
ab96e1d166 Document what -O4/-O5 are actually doing (-O3) 2016-05-22 19:21:55 +01:00
Kai Nacke
8391626ddd Remove PassNameParser (may be breaking some command lines!)
This PR removes the command line option which adds the pass names as additional
command line options. This code prevents compiling for AArch64 (since LLVM 3.7)
and ARM (since LLVM 3.8). Recommendation on LLVM list was to use the PassNameParser
only in test tools but not in a production compiler.
2016-03-12 16:58:21 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
75b3270a19 optimizer: Do not disable codegen opt if -g is given
It has been a long time since this actually caused problems. If some
start to show up again, we should preferrably come up with a local fix
instead of globally disable everything (which is horrible for -O3 -g
builds).
2015-11-03 11:35:06 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
kai
9d3dd1f609 Add true value of "isOptimized" to Dwarf debug info. 2015-05-31 21:32:12 +02:00
kai
4db0123bb7 Implement FlagParser using llvm:🆑:generic_parser_base.
This approach is easier and requires less code. With some template foo
the BoolOrDefaultAdapter is not required.

This solutions applies to previous LLVM versions, too.
2015-04-25 21:47:30 +02:00
kai
66bf03b96b LLVM 3.7: DataLayoutPass is gone.
DataLayout is now non-optional at the module. Therefore
there is no need for a separate DataLayoutPass.
2015-03-06 17:13:00 +01:00
Kevin Brogan
d8f4a2758a Trigger a travis rebuild 2015-02-17 02:09:14 -08:00
unknown
e56ef8b86e copy paste error fix 2015-02-16 15:27:19 -08:00
unknown
674b614807 Update of PassManager interface to match the corresponding deprecation in LLVM's trunk for 3.7 2015-02-16 15:11:42 -08:00
kai
197c32e118 LLVM 3.7: Use new TargetMachine.getTargetIRAnalysis() analysis pass.
This replaces the TargetMachine.addAnalysisPasses() method.
2015-02-04 07:46:14 +01:00
kai
e3e10a0a86 LLVM 3.7: Add changes for TargetLibraryInfo and DataLayout.
The TargetLibraryInfo class is now a wrapper. The real implementation
is TargetLibraryInfoImpl.

The TargetMachine can be asked for the DataLayout (like in all other
supported versions except 3.6)
2015-01-30 08:08:14 +01:00
Kai Nacke
18118d724a Add support for LLVM 3.7
The branch for LLVM 3.7 was created this week.
LLVM trunk is now 3.7.
2015-01-18 21:45:13 +01:00
kai
bef163f559 Fix latest LLVM 3.6 changes 2014-09-19 06:49:34 +02:00
kai
f8a53ab3dc Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-03-12 18:27:43 +01:00
kai
6442d79b8b Finally enable the vectorizer (at least in LLVM 3.5).
It still requires verification if this works with LLVM 3.4. Problem was the changed
initialisation of passes in LLVM 3.4/3.5.
2014-03-12 17:12:25 +01:00
kai
9156601d76 Add code for the changed DataLayoutPass in LLVM 3.5 2014-03-10 06:54:59 +01:00
kai
2f2fa92df3 Fix includes for LLVM 3.5 2014-03-07 06:40:39 +01:00
Kai Nacke
fe39da53e3 Merge of 2.065.0-b3.
The new visitor class is used for IR generation. This removes some modifications from DMD source.
2014-02-10 08:47:25 +01:00
kai
cd9e468201 Enable command line option -disable-simplify-libcalls for LLVM 3.4+. 2014-02-04 18:07:46 +01:00
kai
aaaca39a4e Enable vectorizer with LLVM 3.4+.
The missing initialization code disables the vectorizer.
2014-02-04 07:18:32 +01:00
Kai Nacke
ea9c996dcd Fix new signature of verifyModule() in LLVM 3.5. 2014-01-19 12:36:42 +01:00
Kai Nacke
c14e065138 Fix the LLVM 3.5 build.
Some classes were moved into IR folder.
2014-01-13 17:08:43 +01:00
kai
e6529cfd3d [experimental] Add sanitizer options to LDC.
Add some of the sanitizer passes to LDC. This is not complete (linking must be
done using clang and the right `-fsanitize=` option) and may not be useful at
all.

If it proves to be usefull then a lot of other options (e.g. blacklist) must be
added.
2013-11-05 13:03:52 +01:00
kai
609b362410 Fix the LLVM 3.4 build.
The disable-simplify-libcalls is gone.
2013-06-21 23:44:42 +02:00
David Nadlinger
43e27d0dd1 Remove USE_METADATA.
It has been on by default for quite some time now.
2013-06-07 02:48:53 +02:00
David Nadlinger
c02b38fe9a Removed LLVM 3.0 compatibility code.
There might be still some pieces left here and there, and
there is certainly code that could be rewritten in a nicer
way with the 3.0 requirement out of the picture.
2013-05-31 20:48:38 +02:00
David Nadlinger
bb5b60e591 Make '-O' equivalent to '-O3'.
I have seen it used several times in benchmarks comparing it
to 'gdc -O3' and 'dmd -O -inline' now, so people apparently
expect it to yield the highest available optimization level.
2013-03-17 02:09:54 +01:00
David Nadlinger
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
kai
a11459bc31 "The Great Renaming" continues.
More changes to match the renamed files of LLVM 3.3.
2013-01-06 17:17:30 +01:00
kai
272e7b7a55 Follow "The Great Renaming" in LLVM 3.3
This time VMCore was renamed to IR. Several top level include
files were moved to new subfolder IR.
2013-01-03 08:52:23 +01:00
David Nadlinger
7be9c5c5c7 dgc2stack: LLVM 3.2 compatibility. 2012-12-20 23:52:25 +01:00
David Nadlinger
9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
David Nadlinger
2d02270434 Re-enabled codegen optimization on LLVM 3.2.
The bug (PR14376) has been fixed in both master and the release branch.
2012-11-24 14:07:17 +01:00
kai
45848d19fc Remove unused include. This fixes yet another MSVC-related compile problem.
Root cause is the `root.h` defines `strtof` which is used in `llvm/Target/TargetLibraryInfo.h` as an enumeration identifier.
2012-11-18 17:52:10 +01:00