[PATCH] D103856: [Attributor] Introduce a helper do deal with constant type mismatches

Kuter Dinel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 15:04:33 PDT 2021


kuter added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4637
       // We can replace the AssociatedValue with the constant.
-      if (!V.user_empty() && &V != C && V.getType() == C->getType()) {
-        LLVM_DEBUG(dbgs() << "[ValueSimplify] " << V << " -> " << *C
+      if (!V.user_empty() && &V != C && NewV) {
+        LLVM_DEBUG(dbgs() << "[ValueSimplify] " << V << " -> " << *NewV
----------------
NIT:  &V != C is already checked and must be true.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4782
                   : UndefValue::get(V.getType());
-    if (C) {
+    if (C && C != &V) {
       auto PredForReturned =
----------------
I  think the associated value for a `RETURNED` position is the value to the function itself so I don't think it makes sense to do this check. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103856



More information about the llvm-commits mailing list