This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/81248] No ipa-sra optimization for small struct / class


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);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]