[PATCH] D27855: [InstCombine] try to extend nonnull-ness of arguments from a callsite back to its parent function

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 12:19:35 PST 2016

spatel added a reviewer: reames.
spatel added inline comments.

Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2779-2820
+/// If a callsite has arguments that are also arguments to the parent function,
+/// try to propagate attributes from the callsite's arguments to the parent's
+/// arguments.
+static Instruction *extendArgAttrsToCaller(CallSite &CS, DominatorTree &DT) {
+  // Make sure that this callsite is part of a function.
+  BasicBlock *BB = CS.getParent();
+  if (!BB)
majnemer wrote:
> Any chance this logic could live in `llvm::isKnownNonNullAt`
Hmm...yes, that would probably be better. Today's comments in the earlier linked llvm-dev thread suggest that this approach (adding attributes that enable existing analysis rather than doing more analysis) is not ideal, so we might want to abandon this entirely for simplify/combines that do the work directly.


More information about the llvm-commits mailing list