[PATCH] D104432: [Attributor] Introduce AAPointerInfo
Axel Y. Rivera via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 12:37:41 PDT 2022
ayrivera added inline comments.
Herald added a project: All.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:1101
+ for (const AAPointerInfo::Access &RAcc : It.second) {
+ if (IsByval && !RAcc.isRead())
+ continue;
----------------
Hi,
I attached a example that produces a segmentation fault in line 1100. The example is pretty simple, a function foo that allocates a space which is a structure type, the argument of foo is written in one field, then calls bar, which writes in another field of the allocated space.
I'm not familiar with this optimization, but will try to explain the best I can. Tracing the issue I found that getAAFor is called in line 1242 from updateImpl (recent version of the file should be around 1495), the creation of an AA calls a function that updates the information (updateImpl), which calls translateAndAddCalleeState from line 1363 (1628 in the recent file). The condition in 1101 happens for one of the entries in It.second, so addChange didn't run for a particular access.
Once the AA is created for line 1242 (1495), the function translateAndAddCalleeState runs again in line 1245 (1498). But now we have states (It) where the second entry in the pair is a null pointer. This produces a segmentation fault when traversing the loop in line 1100. The reason seems to be because addChange skipped an access during the first call of translateAndAddCalleeState then there is no information for the access.
You can run the test case with the following command:
```
opt simple_attributor.ll -S
```
{F22909941}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104432/new/
https://reviews.llvm.org/D104432
More information about the llvm-commits
mailing list