llvm-project/clang/lib
Simon Tatham 06d07ec4a3 [Clang] Handle target-specific builtins returning aggregates.
Summary:
A few of the ARM MVE builtins directly return a structure type. This
causes an assertion failure at code-gen time if you try to assign the
result of the builtin to a variable, because the `RValue` created in
`EmitBuiltinExpr` from the `llvm::Value` produced by codegen is always
made by `RValue::get()`, which creates a non-aggregate `RValue` that
will fail an assertion when `AggExprEmitter::withReturnValueSlot` calls
`Src.getAggregatePointer()`. A similar failure occurs if you try to use
the struct return value directly to extract one field, e.g.
`vld2q(address).val[0]`.

The existing code-gen tests for those MVE builtins pass the returned
structure type directly to the C `return` statement, which apparently
managed to avoid that particular code path, so we didn't notice the
crash.

Now `EmitBuiltinExpr` checks the evaluation kind of the builtin's return
value, and does the necessary handling for aggregate returns. I've added
two extra test cases, both of which crashed before this change.

Reviewers: dmgreen, rjmccall

Reviewed By: rjmccall

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72271
2020-01-09 17:28:37 +00:00
..
ARCMigrate Removed some questionable default arguments from setters 2019-09-12 12:16:43 +00:00
AST Improve support of GNU mempcpy 2020-01-09 17:31:00 +01:00
ASTMatchers Add a new AST matcher 'optionally'. 2020-01-08 14:10:11 -05:00
Analysis [CFG] Fix an assertion failure with static initializers 2019-12-23 16:35:37 -08:00
Basic [PowerPC]: Add powerpcspe target triple subarch component 2020-01-08 19:10:53 -06:00
CodeGen [Clang] Handle target-specific builtins returning aggregates. 2020-01-09 17:28:37 +00:00
CrossTU [CrossTU] Fix problem with CrossTU AST load limit and progress messages. 2019-08-12 07:15:29 +00:00
DirectoryWatcher [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
Driver [ARM][MVE] MVE-I should not be disabled by -mfpu=none 2020-01-09 14:03:25 +00:00
Edit [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast 2019-07-02 18:28:13 +00:00
Format [clang-format] fix conflict between FormatStyle::BWACS_MultiLine and BeforeCatch/BeforeElse 2020-01-06 09:21:41 -05:00
Frontend [HIP] Add option --gpu-max-threads-per-block=n 2020-01-07 11:18:00 -05:00
FrontendTool [analyzer] Don't run the analyzer for -analyzer-list-enabled-checkers 2019-09-12 18:53:48 +00:00
Headers [X86] Mark various pointer arguments in builtins as const 2019-12-19 11:42:11 -08:00
Index [Wdocumentation] Implement \anchor 2019-12-21 14:52:21 +01:00
Lex [APFloat] Fix checked error assert failures 2020-01-09 09:42:32 +02:00
Parse [Concepts] Function trailing requires clauses 2020-01-09 15:07:51 +02:00
Rewrite [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug 2019-08-15 21:17:48 +00:00
Sema Improve support of GNU mempcpy 2020-01-09 17:31:00 +01:00
Serialization [Concepts] Function trailing requires clauses 2020-01-09 15:07:51 +02:00
StaticAnalyzer [NFC] Fixes -Wrange-loop-analysis warnings 2020-01-01 20:01:37 +01:00
Tooling [Syntax] Build spanning SimpleDecalration for classes, structs, etc 2020-01-03 12:33:11 +01:00
CMakeLists.txt Reland [clang] DirectoryWatcher 2019-07-12 20:34:10 +00:00