[llvm] 9dcf889 - [Attributor][NFC] Do not (try to) simplify void values

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 16:43:31 PST 2020


Author: Johannes Doerfert
Date: 2020-01-23T18:42:45-06:00
New Revision: 9dcf889d15dc28203a1e001c0a562920377b8337

URL: https://github.com/llvm/llvm-project/commit/9dcf889d15dc28203a1e001c0a562920377b8337
DIFF: https://github.com/llvm/llvm-project/commit/9dcf889d15dc28203a1e001c0a562920377b8337.diff

LOG: [Attributor][NFC] Do not (try to) simplify void values

We might accidentally ask AAValueSimplify to simplify a void value. That
can lead to very interesting, and very wrong, results. We now handle
this case gracefully.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 527cacc68167..46e5c16990e2 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -4131,6 +4131,12 @@ struct AANoCaptureCallSiteReturned final : AANoCaptureImpl {
 struct AAValueSimplifyImpl : AAValueSimplify {
   AAValueSimplifyImpl(const IRPosition &IRP) : AAValueSimplify(IRP) {}
 
+  /// See AbstractAttribute::initialize(...).
+  void initialize(Attributor &A) override {
+    if (getAssociatedValue().getType()->isVoidTy())
+      indicatePessimisticFixpoint();
+  }
+
   /// See AbstractAttribute::getAsStr().
   const std::string getAsStr() const override {
     return getAssumed() ? (getKnown() ? "simplified" : "maybe-simple")
@@ -4146,7 +4152,6 @@ struct AAValueSimplifyImpl : AAValueSimplify {
       return const_cast<Value *>(&getAssociatedValue());
     return SimplifiedAssociatedValue;
   }
-  void initialize(Attributor &A) override {}
 
   /// Helper function for querying AAValueSimplify and updating candicate.
   /// \param QueryingValue Value trying to unify with SimplifiedValue


        


More information about the llvm-commits mailing list