[PATCH] D51431: [WIP][IPSCCP] Add lattice value for != constant and propagate nonnull.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 30 09:16:32 PDT 2018
fhahn added inline comments.
================
Comment at: lib/Transforms/Scalar/SCCP.cpp:844
+ if (IV.isNotConstant())
+ return (void)markOverdefined(&PN);
+
----------------
efriedma wrote:
> I guess you could try to resolve a PHI to NotConstant...? Not sure how important that is.
Yep, there should be a TODO here (and in other places)
================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1785
+ IPNumNonNullAdded++;
+ CS.addParamAttr(ArgNo, Attribute::NonNull);
+ }
----------------
efriedma wrote:
> I'm not sure this is right: nonnull is UB if the value is null, but SCCP can merge an "Undef" into a NotConstant.
I think I am missing something. tryToAddNonNull is used after we finished solving and a lattice value of notconstant(Null) should mean "we proved that the value is != null". If we merge an undef into a NotConstant, isn't that similar to when we merge an undef into a Constant, where it is safe to use the constant after solving?
https://reviews.llvm.org/D51431
More information about the llvm-commits
mailing list