[PATCH] D56447: Enable IPConstantPropagation to work with abstract call sites

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 20:08:36 PST 2019


reames added inline comments.


================
Comment at: lib/Transforms/IPO/IPConstantPropagation.cpp:65
 
-    // Used by a non-instruction, or not the callee of a function, do not
-    // transform.
-    if (!isa<CallInst>(UR) && !isa<InvokeInst>(UR))
-      return false;
-
-    CallSite CS(cast<Instruction>(UR));
-    if (!CS.isCallee(&U))
+    // If no abstract call site was created the use is invalid.
+    AbstractCallSite ACS(&U);
----------------
"is invalid" probably isn't quite the right wording.

Maybe: If we don't understand the use, bail?


================
Comment at: lib/Transforms/IPO/IPConstantPropagation.cpp:83
+      // We can only propagate thread independent values through callbacks.
+      if (C && ACS.isCallbackCall() && C->isThreadDependent()) {
+        // Argument became non-constant. If all arguments are non-constant now,
----------------
Can you explain this bit?  I don't understand the intention from the context.  Why would it be legal to constant fold a thread dependent constant through a direct callee, but not an indirect callback callee?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56447





More information about the llvm-commits mailing list