Issue 141309
Summary inconsistent copy propagation for aggregates across calls with local alloc
Labels new issue
Assignees
Reporter pinskia
    Take:
```
struct f {
    int a[1024];
};

void g();
struct f hh();

struct f h(float *fp) {
 struct f a;
    a = hh();
    struct f b = a;
    g();
    *fp = 1;
 a = b;
    return a;
}

struct f h1(float *fp) {
    struct f a = hh();
    struct f b = a;
    g();
    *fp = 1;
    a = b;
    return a;
}
```

These 2 functions should produce the exact same code generation. The only difference between then is where the assignment to a happens; on the decl initializer or outside of it.
h produces better code generation than h1; h1 has 2 calls to memcpy while h has 0.
https://godbolt.org/z/GfMq96rTY for reference.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to