[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.
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 527cacc..46e5c16 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -4131,6 +4131,12 @@
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 @@
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