[PATCH] D72562: [Attributor][Fix] AAHeapToStack and AAIsDead connection

Stefan Stipanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 11:49:08 PST 2020


sstefan1 marked 3 inline comments as done.
sstefan1 added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2915
+      if (isMallocOrCallocLikeFn(I, TLI) || isFreeCall(I, TLI))
+        return ChangeStatus::CHANGED;
+
----------------
jdoerfert wrote:
> sstefan1 wrote:
> > jdoerfert wrote:
> > > Would it work the other way around, as well? Deleting them here not in H2S. If so it would remove the special case here and some code in H2S, right?
> > I had this in mind, but I don't think it would work because `isAssumedSideEffectFree()` will be false.
> I see. In that case, can you move the special logic into `isAssumedSideEffectFree` to cut down on the duplication and allow reuse later on?
I've given this some more thought. While it would indeed be nicer to delete H2S stuff here as well, I think that can't work. Consider this example from the tests:

  define void @nofree_arg_only(i8* %p1, i8* %p2) {
    tail call void @free(i8* %p2)
    tail call void @nofree_func(i8* %p1)
    ret void
  }

Here `free()` is neither nounwind nor readonly but would be considered side effect free because we made `isAssumedSideEffectFree` consider it that way. As a result, since it is void value, it is deleted. Although it shouldn't have been.

If you still think we can/should do it, let me know.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:3048
+        IsAssumedSideEffectFree = true;
+        return indicateOptimisticFixpoint();
+      }
----------------
jdoerfert wrote:
> This is assumed information, correct? If so, we cannot indicate a fixpoint and we need to record a dependence if we use the information.
Correct. Interestingly, though, it doesn't work without indicating fixpoint.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72562





More information about the llvm-commits mailing list