Commit Graph

18 Commits

Author SHA1 Message Date
Mehdi Amini 6aa9e9b41a IRGen: Add optnone attribute on function during O0
Amongst other, this will help LTO to correctly handle/honor files
compiled with O0, helping debugging failures.
It also seems in line with how we handle other options, like how
-fnoinline adds the appropriate attribute as well.

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

llvm-svn: 304127
2017-05-29 05:38:20 +00:00
Chandler Carruth fcd33149b4 Cleanup the handling of noinline function attributes, -fno-inline,
-fno-inline-functions, -O0, and optnone.

These were really, really tangled together:
- We used the noinline LLVM attribute for -fno-inline
  - But not for -fno-inline-functions (breaking LTO)
  - But we did use it for -finline-hint-functions (yay, LTO is happy!)
  - But we didn't for -O0 (LTO is sad yet again...)
- We had weird structuring of CodeGenOpts with both an inlining
  enumeration and a boolean. They interacted in weird ways and
  needlessly.
- A *lot* of set smashing went on with setting these, and then got worse
  when we considered optnone and other inlining-effecting attributes.
- A bunch of inline affecting attributes were managed in a completely
  different place from -fno-inline.
- Even with -fno-inline we failed to put the LLVM noinline attribute
  onto many generated function definitions because they didn't show up
  as AST-level functions.
- If you passed -O0 but -finline-functions we would run the normal
  inliner pass in LLVM despite it being in the O0 pipeline, which really
  doesn't make much sense.
- Lastly, we used things like '-fno-inline' to manipulate the pass
  pipeline which forced the pass pipeline to be much more
  parameterizable than it really needs to be. Instead we can *just* use
  the optimization level to select a pipeline and control the rest via
  attributes.

Sadly, this causes a bunch of churn in tests because we don't run the
optimizer in the tests and check the contents of attribute sets. It
would be awesome if attribute sets were a bit more FileCheck friendly,
but oh well.

I think this is a significant improvement and should remove the semantic
need to change what inliner pass we run in order to comply with the
requested inlining semantics by relying completely on attributes. It
also cleans up tho optnone and related handling a bit.

One unfortunate aspect of this is that for generating alwaysinline
routines like those in OpenMP we end up removing noinline and then
adding alwaysinline. I tried a bunch of other approaches, but because we
recompute function attributes from scratch and don't have a declaration
here I couldn't find anything substantially cleaner than this.

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

llvm-svn: 290398
2016-12-23 01:24:49 +00:00
David Majnemer fcbdb6ea58 Update clang to take into account the changes to personality fns
llvm-svn: 239941
2015-06-17 20:53:19 +00:00
David Blaikie bdf40a62a7 Test case updates for explicit type parameter to the gep operator
llvm-svn: 232187
2015-03-13 18:21:46 +00:00
Bill Wendling 706469b453 Add more of the command line options as attribute flags.
These can be easily queried by the back-end.

llvm-svn: 176304
2013-02-28 22:49:57 +00:00
Bill Wendling 2386bb130c Reapply r176133 with testcase fixes.
llvm-svn: 176145
2013-02-27 00:06:04 +00:00
Anna Zaks 0f424b029b Revert "Add more attributes from the command line to functions."
This reverts commit 176009.

The commit is a likely cause of several buildbot failures.

llvm-svn: 176044
2013-02-25 19:51:03 +00:00
Bill Wendling 87869db5f5 Add more attributes from the command line to functions.
This is an ongoing process. Any command line option which a back-end cares about
should be added here.

llvm-svn: 176009
2013-02-25 07:15:16 +00:00
Bill Wendling c33fc4c004 Modify the tests to use attribute group references instead of listing the
function attributes.

llvm-svn: 175606
2013-02-20 07:22:19 +00:00
Bill Wendling 985d1c5d15 Add the 'target-cpu' and 'target-features' attributes to functions.
The back-end will use these values to reconfigure code generation for different
features.

llvm-svn: 175308
2013-02-15 21:30:01 +00:00
David Chisnall 2ec1b10d8e Enable the new (more C++-like, less broken) EH model when targeting the GNUstep
Objective-C runtime 1.7 or greater.

llvm-svn: 172207
2013-01-11 15:33:01 +00:00
David Chisnall 9a837be2b9 Fix the Objective-C exception rethrow from cleanups (GNU runtimes). Note that
a bug in the inliner still causes the wrong thing to happen at -O2 and above
(PR14116).

llvm-svn: 167534
2012-11-07 16:50:40 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Bill Wendling f0724e8e06 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

llvm-svn: 140049
2011-09-19 20:31:14 +00:00
Anders Carlsson 3320e1575f Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.
Update all tests accordingly.

llvm-svn: 126177
2011-02-22 01:52:06 +00:00
John McCall ad5d61e227 Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.

llvm-svn: 109274
2010-07-23 21:56:41 +00:00
John McCall 36ea3723c0 The GNU-runtime ObjC personality function doesn't let us rethrow with URR for
multiple reasons.  Rethrow with _objc_exception_throw instead.  Fixes PR7656.

llvm-svn: 108595
2010-07-17 00:43:08 +00:00