[PATCH] D93838: [SCCP] Add Function Specialization pass

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 6 20:23:50 PDT 2021


ChuanqiXu added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1056-1062
+    // If the argument isn't overdefined, there's nothing to do. It should
+    // already be constant.
+    if (!Solver.getLatticeValueFor(A).isOverdefined()) {
+      LLVM_DEBUG(dbgs() << "FnSpecialization: nothing to do, arg is already "
+                        << "constant?\n");
+      return false;
+    }
----------------
To my knowledge, if the Lattice for A is constant, it could be handled by current IPSCCP. But what if the lattice is constant range?


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1261-1283
+// This transformation applied on this example:
+//
+//   define internal void @someFunc(i32* arg1) {
+//     %temp = alloca i32, align 4
+//     store i32 2, i32* %temp, align 4
+//     call void @otherFunc(i32* nonnull %temp)
+//     ret void
----------------
I can't understand why don't we use constant value directly?


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

https://reviews.llvm.org/D93838



More information about the llvm-commits mailing list