[llvm] 1364d85 - [Attributor][NFC] Do not manifest noundef for positions to be changed to undef

Shinji Okumura via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 11:49:54 PDT 2020


Author: Shinji Okumura
Date: 2020-08-30T03:23:41+09:00
New Revision: 1364d856f4bf79e6d40da259c816109b77581184

URL: https://github.com/llvm/llvm-project/commit/1364d856f4bf79e6d40da259c816109b77581184
DIFF: https://github.com/llvm/llvm-project/commit/1364d856f4bf79e6d40da259c816109b77581184.diff

LOG: [Attributor][NFC] Do not manifest noundef for positions to be changed to undef

This patch fixes AANoUndef manifestation.
We should not manifest noundef for positions that will be changed to undef.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86835

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 8098379b659a..5c4754c57387 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -7812,6 +7812,13 @@ struct AANoUndefImpl : AANoUndef {
     // values.
     if (A.isAssumedDead(getIRPosition(), nullptr, nullptr))
       return ChangeStatus::UNCHANGED;
+    // A position whose simplified value does not have any value is
+    // considered to be dead. We don't manifest noundef in such positions for
+    // the same reason above.
+    auto &ValueSimplifyAA = A.getAAFor<AAValueSimplify>(
+        *this, getIRPosition(), /* TrackDependence */ false);
+    if (!ValueSimplifyAA.getAssumedSimplifiedValue(A).hasValue())
+      return ChangeStatus::UNCHANGED;
     return AANoUndef::manifest(A);
   }
 };


        


More information about the llvm-commits mailing list