[PATCH] D94180: [SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 12:09:08 PST 2021


nikic added a comment.

Logic looks fine now, though the GEP handling can be made a bit more lax.



================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6572
       if (GEP->getPointerOperand() == I)
-        return passingValueIsAlwaysUndefined(V, GEP);
+        return passingValueIsAlwaysUndefined(V, GEP, true);
+
----------------
jdoerfert wrote:
> `/* IsUndef... */ true`
Could be more precise using something like:
```
if (!GEP->isInBounds() || !GEP->hasAllZeroIndices())
  IsUndefFromGEP = true;
return passingValueIsAlwaysUndefined(V, GEP, IsUndefFromGEP);
```
Though that makes the naming even more awkward. @jdoerfert's suggestion of `PtrValueMayBeModified` would make more sense.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94180/new/

https://reviews.llvm.org/D94180



More information about the llvm-commits mailing list