[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / CodeGenCXX / partitions.cpp
blobb58e88fafdc6b15cbef0dcf9b00b4b0040445167
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple %t/parta.cppm -o %t/mod-parta.pcm
6 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple %t/partb.cppm -o %t/mod-partb.pcm
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple -fmodule-file=%t/mod-parta.pcm \
8 // RUN: -fmodule-file=%t/mod-partb.pcm %t/mod.cppm -o %t/mod.pcm
9 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/mod.pcm -S -emit-llvm -disable-llvm-passes -o - \
10 // RUN: | FileCheck %t/mod.cppm
11 // RUN: %clang_cc1 -std=c++20 -O2 -emit-module-interface -triple %itanium_abi_triple -fmodule-file=%t/mod-parta.pcm \
12 // RUN: -fmodule-file=%t/mod-partb.pcm %t/mod.cppm -o %t/mod.pcm
13 // RUN: %clang_cc1 -std=c++20 -O2 -triple %itanium_abi_triple %t/mod.pcm -S -emit-llvm -disable-llvm-passes -o - \
14 // RUN: | FileCheck %t/mod.cppm -check-prefix=CHECK-OPT
16 //--- parta.cppm
17 export module mod:parta;
19 export int a = 43;
21 export int foo() {
22 return 3 + a;
25 //--- partb.cppm
26 module mod:partb;
28 int b = 43;
30 int bar() {
31 return 43 + b;
34 //--- mod.cppm
35 export module mod;
36 import :parta;
37 import :partb;
38 export int use() {
39 return foo() + bar() + a + b;
42 // FIXME: The definition of the variables shouldn't be exported too.
43 // CHECK: @_ZW3mod1a = available_externally global
44 // CHECK: @_ZW3mod1b = available_externally global
45 // CHECK: declare{{.*}} i32 @_ZW3mod3foov
46 // CHECK: declare{{.*}} i32 @_ZW3mod3barv
48 // CHECK-OPT: @_ZW3mod1a = available_externally global
49 // CHECK-OPT: @_ZW3mod1b = available_externally global
50 // CHECK-OPT: declare{{.*}} i32 @_ZW3mod3foov
51 // CHECK-OPT: declare{{.*}} i32 @_ZW3mod3barv