comparison gcc/testsuite/g++.dg/ipa/pr81248.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // { dg-do compile { target c++17 } }
2 // { dg-options "-O2 -fdump-tree-eipa_sra" }
3
4
5 #include <type_traits>
6
7 typedef unsigned char __uint8_t;
8 typedef __uint8_t uint8_t;
9
10
11 struct A {
12 A() = default;
13 A(const A& o) = default;
14 A(const volatile A& o) : m1(o.m1) {}
15 uint8_t m1{0};
16 };
17
18 volatile uint8_t v;
19
20 template<typename T>
21 void f(const T& x) __attribute__((noinline));
22 template<typename T>
23 void f(const T& x) {
24 if constexpr(std::is_same<std::remove_cv_t<T>, A>::value) {
25 v = x.m1;
26 }
27 else {
28 v = x;
29 }
30 }
31
32 uint8_t n1;
33 A n2;
34
35 int main() {
36 f(n1);
37 f(n2);
38 }
39
40 // { dg-final { scan-tree-dump-times "Adjusting call" 2 "eipa_sra" } }