[PATCH] D64656: Ensure placeholder instruction for cleanup is created

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 13 08:38:04 PDT 2019


lebedev.ri resigned from this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

In D64656#1584437 <https://reviews.llvm.org/D64656#1584437>, @oydale wrote:

> My understanding of the issue is that clang emits incorrect IR. Without my fix and when disabling the assertion mentioned in the commit message by commenting it out, llvm-lit gives the following output when executed against the minimal test case in the current version of the commit:
>
>   + /home/maestro/llvm/llvm-project/build/bin/clang -cc1 -internal-isystem /home/maestro/llvm/llvm-project/build/lib/clang/9.0.0/include -nostdsysteminc -emit-obj --std=c++17 -fcxx-exceptions -fexceptions /home/maestro/llvm/llvm-project/clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp
>   Instruction referencing instruction not embedded in a basic block!
>     %cleanup.isactive = alloca i1, align 1
>     store i1 true, i1* %cleanup.isactive, align 1
>   in function __cxx_global_var_init.1
>   fatal error: error in backend: Broken function found, compilation aborted!
>
>
> This is what makes me assume that the IR output is incorrect.


Aha, this i didn't see before, thank you.
Then i agree the clang fix is needed.

> ...

Since some other assertion (in `-verify` pass?) triggers before the SROA crash can be reached, i think may be no middle-end issue here after all.



================
Comment at: clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp:14-18
+// CHECK: %cleanup.isactive = alloca i1, align 1
+// CHECK: call void @_ZN1RC1E1Q(%struct.R* %ref.tmp)
+// CHECK: store i1 true, i1* %cleanup.isactive, align 1
+// CHECK: invoke void @_ZN1SC1E1Q(%struct.S* %ref.tmp1)
+// CHECK:   to label %invoke.cont unwind label %lpad
----------------
2 things:
1. These should be `CHECK-NEXT:`.
2. This will immediately break in release build mode, since the value names will be discarded.
   You want to follow https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-string-substitution-blocks


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64656/new/

https://reviews.llvm.org/D64656





More information about the cfe-commits mailing list