[llvm] LowerTypeTests: Fix quadratic complexity (try 2). (PR #136053)
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 17:14:49 PDT 2025
pcc wrote:
> please confirm the `ScopedSaveAliaseesAndUsed` use on line 2063 (of RHS, 2050 of LHS) is OK with the semantics change
This change actually fixes a crash in the affected case. Previously this would crash:
```
$ cat au.c
__attribute__((alias("g"), used)) void f(void);
void g(void) {}
$ cat b.c
__attribute__((weak)) void f(void) {}
void f(void);
int main(int argc, char **argv) {
argv[0] = (char *)f;
void (*fp)(void) = (void (*)(void))argv;
fp();
}
$ ~/l2/ra/bin/clang au.c b.c -flto=thin -fuse-ld=lld -fsanitize=cfi-icall -Wl,--save-temps
While deleting: ptr %
Use still stuck around after Def is destroyed:[1 x ptr] [ptr <badref>]
```
Now we at least don't crash but fail to link instead (this is a separate known issue):
```
~/l3/ra/bin/clang au.c b.c -flto=thin -fuse-ld=lld -fsanitize=cfi-icall -Wl,--save-temps
ld.lld: error: undefined hidden symbol: f.cfi
>>> referenced by ld-temp.o
>>> a.out.lto.o:(g)
>>> did you mean: g.cfi
>>> defined in: /tmp/a.out.lto.au-fd4132.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
https://github.com/llvm/llvm-project/pull/136053
More information about the llvm-commits
mailing list