Commit Graph

44 Commits

Author SHA1 Message Date
Erik Eckstein
f1b4101295 MergeFunctions: use new LLVM API to create a call.
rdar://problem/61734317
2020-04-14 12:28:51 +02:00
Saleem Abdulrasool
71e8f866bb LLVMPasses: mark the dump as debug code
This limits the dumping of the variables to the debug build since
`llvm::Value::dump` is only available in debug builds of LLVM.
2020-02-29 20:47:20 -08:00
Saleem Abdulrasool
2c91da5d88 lib: update for LLVM API change
TerminatorInst has been removed and been made into a regular Instruction.  Use
the `isTerminator` function instead of the dyn_cast.
2019-02-07 17:54:59 -08:00
Vedant Kumar
0db7e4864f [mergefunc] Avoid eliminating dtrace patchpoints (#21305)
Dtrace has special linker support to detect and patch probe call sites.

Each call to a dtrace probe must resolve to a unique patchpoint.

rdar://45738058
2018-12-13 15:57:52 -08:00
Erik Eckstein
bcc13e8060 Fix a miscompile in the swift function merging pass.
In rare corner cases the pass merged two functions which contain incompatible call instructions.
See source comment in the change for details.

rdar://problem/43051718
2018-08-09 14:46:06 -07:00
Bob Wilson
8e330ee344 NFC: Fix indentation around the newly renamed LLVM_DEBUG macro.
Jordan used a sed command to rename DEBUG to LLVM_DEBUG. That caused some
lines to wrap and messed up indentiation for multi-line arguments.
2018-07-21 00:56:18 -07:00
Jordan Rose
cefb0b62ba Replace old DEBUG macro with new LLVM_DEBUG
...using a sed command provided by Vedant:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
2018-07-20 14:37:26 -07:00
Sho Ikeda
7e6220c572 [gardening][LLVMPasses] Replace typedef with using 2018-03-28 21:39:12 +09:00
Joe Shajrawi
91d763e5ac Lower the FunctionMergeThreshold from 30 to 15 2017-12-19 11:20:33 -08:00
swift-ci
a9bcdddb77 Merge remote-tracking branch 'origin/master' into master-next 2017-05-24 17:48:35 -07:00
Erik Eckstein
d342041420 Mangling: use ‘Tm’ mangling for merged functions
Previously merged functions just got the name with a “_merged” suffix
2017-05-24 17:00:16 -07:00
Bob Wilson
8d61e93e81 Adapt to LLVM r301812 rename of WeakVH to WeakTrackingVH 2017-05-07 22:25:49 -07:00
Bob Wilson
e917b3cabf Tidy loop iterator to match the MergeFunctions.cpp change from LLVM r273808 2017-05-07 22:23:34 -07:00
swift-ci
502bda365b Merge remote-tracking branch 'origin/master' into master-next 2017-05-05 13:48:34 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
Bob Wilson
c35eed4964 Update SwiftMergeFunctions::replaceDirectCallers to match LLVM r300272 2017-04-16 22:05:15 -07:00
Bob Wilson
bd81b41de4 Update Swift master-next after LLVM API change in r300014.
AttributeSet was added back again, wrapping AttributeSetNode*.
2017-04-13 11:25:22 -07:00
swift-ci
6b8c0aa04a Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 20:28:32 -07:00
Saleem Abdulrasool
cfb9da8dfe Adjust for SVN r299899 2017-04-11 18:19:49 -07:00
Erik Eckstein
f3a7824028 MergeFunctions: now really handle self recursions correctly.
fixes rdar://problem/31519893
2017-04-11 13:57:29 -07:00
Bob Wilson
701ed9d907 Merge remote-tracking branch 'origin/master' into master-next 2017-04-07 15:36:24 -07:00
Erik Eckstein
2584078e3c MergeFunctions: handle self recursive functions correctly.
First, it fixes a crash where the eliminated function is still referenced.
This shows up if two equivalent self-recursive functions are merged and those functions are internal.
Fixes SR-4514, rdar://problem/31479425

Second, it avoids creating a not needed parameter for really equivalent self recursive functions.
2017-04-07 14:21:26 -07:00
Saleem Abdulrasool
15565c116a Adjust for SVN r298393 2017-03-22 07:44:03 -07:00
practicalswift
65b0219f7b [gardening] Fix typos 2017-02-14 20:04:08 +01:00
practicalswift
0193f2b872 [gardening] Fix typos 2017-02-04 09:22:38 +01:00
Erik Eckstein
36c807b0d1 LLVM passes: use new FunctionComparator utility in the SwiftMergeFunctions pass.
Now that the FunctionComparator is a separate utility in LLVM, the SwiftMergeFunctions pass can use it instead of duplicating the code.
This is pure refactoring. NFC.
2017-01-27 13:53:13 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
4552fc8f88 [gardening] Use American English: "behaviour" → "behavior" 2016-11-05 20:33:57 +01:00
Saleem Abdulrasool
8e1a88e985 LLVMPasses: fix DLL storage for merged functions
When constructing the body of the merged function, the internal function is
given internal linkage always.  It is only accessible through the adjusting
thunks which retain the original DLL storage.  Ensure that we reset the DLL
storage which it inherited from the first function.
2016-10-06 08:09:23 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Mark Lacey
4b826b1e2e Silence a few release-build warnings. 2016-07-23 18:33:45 -07:00
Saleem Abdulrasool
3ad600faa6 MergeFunctions: use a custom ordering comparator
This updates MergeFunctions with a custom ordering comparator for the
AtomicOrdering.  This is needed after a LLVM API change which changes the
AtomicOrdering to a strongly typed enumeration.
2016-06-25 01:57:24 -07:00
practicalswift
5a3067e24e [gardening] Fix plural issues. 2016-05-21 18:45:31 +02:00
Mark Lacey
da9c346444 Functions with differing phis should not be merged.
Check that the incoming blocks of phi nodes are identical, and block
function merging if they are not.

rdar://problem/26387654
2016-05-20 08:58:43 -07:00
eeckstein
951086f62e Merge pull request #2531 from practicalswift/fix-llvmmergefunctions-header
[gardening] Add licensing preamble.
2016-05-16 13:49:52 -07:00
practicalswift
e6e360bcfb Merge pull request #2535 from practicalswift/code-whitespace
[gardening] Add missing whitespace.
2016-05-15 07:46:22 +02:00
practicalswift
54427ca61e [gardening] Add missing whitespace. 2016-05-15 07:45:52 +02:00
swift-ci
04f44e22f9 Merge pull request #2533 from practicalswift/remove-unused-var 2016-05-14 18:27:53 -07:00
practicalswift
21c872c590 [gardening] Fix recently introduced typos. 2016-05-14 20:33:28 +02:00
practicalswift
6cc92e78b4 [gardening] Remove unused variable FuncsInCallCycleToMerge. 2016-05-14 19:49:48 +02:00
practicalswift
db585be16f [gardening] Add licensing preamble. 2016-05-14 19:25:50 +02:00
Erik Eckstein
cbe78e0839 fix build error in LLVMMergeFunctions caused by upstream llvm changes
(cherry picked from commit 610996a71fade98ea43d9047740feb02b8d4eac3)
2016-05-13 22:04:50 -07:00
Erik Eckstein
f0022a5aac Add an LLVM pass to merge similar functions.
It's like LLVM's MergeFunctions pass, except that it can also merge functions which differ by some constants.
The intention is to merge specialized functions which only differ by metadata lookups. But it can also merge other types of functions.
It gives ~7% code size reducation for the stdlib.

There are still some open TODOs, e.g. to share common code with LLVM's MergeFunctions pass (currently much code is just copied).
2016-05-11 09:46:46 -07:00