This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] Implement static evaluation of memcpy intrinsics for const i8 arrays.
AbandonedPublic

Authored by aemerson on Mar 29 2018, 6:13 AM.

Details

Reviewers
Gerolf
ab
Summary

The evaluation of static constructors would fail in the presence of memcpy intrinsics, such as the following code:

struct c {
char d[3];
int e;
};
int var = 42;
c f = {"ab", var};

however we can still evaluate the memcpy as it's copying from a constant i8 array.

rdar://37690940

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Mar 29 2018, 6:13 AM
aemerson abandoned this revision.Apr 11 2018, 8:37 AM

The motivating use case for this was actually fixed in clang, r325478. Although this may be useful in future for other front-ends/clients of LLVM, this can be revived if needed later.