Commit Graph

11 Commits

Author SHA1 Message Date
Richard Smith 6fc4075ad4 Avoid creating conditional cleanup blocks that contain only @llvm.lifetime.end calls
When a non-extended temporary object is created in a conditional branch, the
lifetime of that temporary ends outside the conditional (at the end of the
full-expression). If we're inserting lifetime markers, this means we could end
up generating

  if (some_cond) {
    lifetime.start(&tmp);
    Tmp::Tmp(&tmp);
  }
  // ...
  if (some_cond) {
    lifetime.end(&tmp);
  }

... for a full-expression containing a subexpression of the form `some_cond ?
Tmp().x : 0`. This patch moves the lifetime start for such a temporary out of
the conditional branch so that we don't need to generate an additional basic
block to hold the lifetime end marker.

This is disabled if we want precise lifetime markers (for asan's
stack-use-after-scope checks) or of the temporary has a non-trivial destructor
(in which case we'd generate an extra basic block anyway to hold the destructor
call).

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338945 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-04 01:25:06 +00:00
Yaxun Liu 228d6ea69b Add RUN line for amdgcn to lit test conditional-temporaries.cpp
This is partial re-commit of r332982.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-16 12:28:51 +00:00
Yaxun Liu afefd298d3 Revert r332982 Call CreateTempMemWithoutCast for ActiveFlag
Due to regression on arm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332991 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 16:13:07 +00:00
Yaxun Liu f5fd97a2fb Call CreateTempMemWithoutCast for ActiveFlag
Introduced CreateMemTempWithoutCast and CreateTemporaryAllocaWithoutCast to emit alloca
without casting to default addr space.

ActiveFlag is a temporary variable emitted for clean up. It is defined as AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer causes assertion in
SetActiveFlag.

Since there is only load/store of ActiveFlag, it is safe to use the original alloca, therefore use
CreateMemTempWithoutCast is called.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332982 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 14:36:26 +00:00
Stephen Lin 93ab6bf534 CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-15 06:47:53 +00:00
Anders Carlsson 8ffc80fe54 Update test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 17:29:32 +00:00
Anders Carlsson c1b32f6968 Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95311 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 17:26:01 +00:00
Anders Carlsson 4e3014be06 Improve conditional temporaries test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 17:23:15 +00:00
Anders Carlsson 5bb0ddd10b Improve test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 17:06:52 +00:00
Daniel Dunbar a5728872c7 Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Anders Carlsson a36bf8f741 Fix lifetime of conditional temporaries. Patch by Victor Zverovich!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 17:27:56 +00:00