[PATCH] D109907: [DSE] Use cached escape info for calls.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 11:42:15 PDT 2021


nikic added inline comments.


================
Comment at: llvm/include/llvm/Analysis/AliasAnalysis.h:812
+  /// or reads the specified memory object \p Object. The caller must ensure the
+  /// object does not escape before the call.
+  ModRefInfo callCaptures(const CallBase *Call, const Value *Object) {
----------------
fhahn wrote:
> nikic wrote:
> > I'm really confused by this API. My understanding is that it computes the ModRefInfo of the call under the assumption that the object is not captured before *or at* the call. The implementation skips over non-nocapture arguments on the premise that these must have already been checked. It only checks whether there are arguments that may mod/ref the object without capturing. With that in mind, the API name seems to be the opposite of what it actually does.
> I changed it to `callNoCapturesBefore`, which should be more in line with `callCapturesBefore` which runs the capture-before checks. The naming is still not that great, I'd appreciate any suggestions.
It's a mouthful, but maybe `getModRefInfoAssumingNoCapture()`?

I think it would be good to adjust the comment here to say "does not escape before or at the call".


================
Comment at: llvm/lib/Analysis/AliasAnalysis.cpp:748
+  if (Call == Object)
+    return ModRefInfo::ModRef;
+
----------------
Just as a side-note, as this is a preexisting issue in this code: This only checks that Object itself is called, but not whether something that aliases Object is called.

Probably doesn't matter much in practice as calling a local object seems like a really weird thing to do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109907



More information about the llvm-commits mailing list