[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-nrvo.cpp
blob6916207b8806accb217b07032fc0418bffab7195
1 // RUN: %clangxx -target x86_64-unknown-unknown -g \
2 // RUN: %s -emit-llvm -S -o - | FileCheck %s
4 // RUN: %clangxx -target x86_64-unknown-unknown -g \
5 // RUN: -fno-elide-constructors %s -emit-llvm -S -o - | \
6 // RUN: FileCheck %s -check-prefix=NOELIDE
8 struct Foo {
9 Foo() = default;
10 Foo(Foo &&other) { x = other.x; }
11 int x;
13 void some_function(int);
14 Foo getFoo() {
15 Foo foo;
16 foo.x = 41;
17 some_function(foo.x);
18 return foo;
21 int main() {
22 Foo bar = getFoo();
23 return bar.x;
26 // Check that NRVO variables are stored as a pointer with deref if they are
27 // stored in the return register.
29 // CHECK: %[[RESULT:.*]] = alloca ptr, align 8
30 // CHECK: call void @llvm.dbg.declare(metadata ptr %[[RESULT]],
31 // CHECK-SAME: metadata !DIExpression(DW_OP_deref)
33 // NOELIDE: %[[FOO:.*]] = alloca %struct.Foo, align 4
34 // NOELIDE: call void @llvm.dbg.declare(metadata ptr %[[FOO]],
35 // NOELIDE-SAME: metadata !DIExpression()