[PATCH] D43695: [IPSCCP] mark musttail calls overdefined (PR36485)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 01:29:08 PST 2018

fhahn added reviewers: fhahn, efriedma.
fhahn added a comment.

Thanks for the patch! Unless I miss something, we might be able to continue using the more precise lattice value while solving and only handle it when doing the actual replacement. Eli, it would be great if you could have a quick look and see if that makes sense.

> Removed FileCheck from the test. It's enough if it doesn't crash, there's nothing to validate.

Could you add  some checks again, checking the musttail calls are preserved? Otherwise, we could do lots of things to "not crash".

Comment at: lib/Transforms/Scalar/SCCP.cpp:1234
+  // Replacing `musttail` instructions with constant breaks `musttail` semantics
+  if (CS.isMustTailCall())
+    return markOverdefined(I);
This is not the place where the actual replacement happens. I think we could keep the lattice value for the musttail call here and continue using it for solving. The replacement happens in tryToReplaceWithConstant. We could check for musttail calls there and do the replacement there.

This way, in case we can determine the return value of a function containing musttail calls, we still can use the return value at the callsite while solving.

Also, in case the musttail callee has no side effects, the call will be removed (D38856), and we could replace the result with the constant.


More information about the llvm-commits mailing list