This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81248] No ipa-sra optimization for small struct / class
- From: "wilhelm dot meier at hs-kl dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 29 Jun 2017 08:37:15 +0000
- Subject: [Bug tree-optimization/81248] No ipa-sra optimization for small struct / class
- Auto-submitted: auto-generated
- References: <bug-81248-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81248
--- Comment #4 from wilhelm.meier@hs-kl.de ---
Here a more stripped down example (without the volatile part):
#include <cstdint>
#include <type_traits>
struct A {
uint8_t m1{0};
};
volatile uint8_t v;
template<typename T>
void f(const T& x) __attribute__((noinline));
template<typename T>
void f(const T& x) {
if constexpr(std::is_same<T, A>::value) {
v = x.m1;
}
else {
v = x;
}
}
uint8_t n1;
A n2;
int main() {
f(n1);
f(n2);
}