diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2021-07-21 15:11:44 -0500 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2021-07-22 00:07:55 -0500 |
commit | 94d3b59c563c077df560401945f32c55f7783e4c (patch) | |
tree | 124573c5f2558c421e5c3177445f0ce73ffd18e2 /llvm/tools/llvm-reduce/llvm-reduce.cpp | |
parent | c819266ecc8fa12e0d567be6b4dd7ea9c4eede87 (diff) | |
download | llvm-94d3b59c563c077df560401945f32c55f7783e4c.zip llvm-94d3b59c563c077df560401945f32c55f7783e4c.tar.gz llvm-94d3b59c563c077df560401945f32c55f7783e4c.tar.bz2 |
[Attributor][FIX] Do not introduce multiple instances of SSA values
If we have a recursive function we could create multiple instantiations
of an SSA value, one per recursive invocation of the function. This is a
problem as we use SSA value equality in various places. The basic idea
follows from this test:
```
static int r(int c, int *a) {
int X;
return c ? r(false, &X) : a == &X;
}
int test(int c) {
return r(c, undef);
}
```
If we look through the argument `a` we will end up with `X`. Using SSA
value equality we will fold `a == &X` to true and return true even
though it should have been false because `a` and `&X` are from different
instantiations of the function.
Various tests for this have been placed in value-simplify-instances.ll
and this commit fixes them all by avoiding to produce simplified values
that could be non-unique at runtime. Thus, the result of a simplify
value call will always be unique at runtime or the original value, both
do not allow to accidentally compare two instances of a value with each
other and conclude they are equal statically (pointer equivalence) while
they are unequal at runtime.
Diffstat (limited to 'llvm/tools/llvm-reduce/llvm-reduce.cpp')
0 files changed, 0 insertions, 0 deletions