Skip to content

Commit

Permalink
[Attributor][FIX] Do not compute ranges for arguments of declarations
Browse files Browse the repository at this point in the history
This cannot be triggered right now, as far as I know, but it doesn't
make sense to deduce a constant range on arguments of declarations.
Exposed during testing of AAValueSimplify extensions.
  • Loading branch information
jdoerfert committed Apr 2, 2020
1 parent a8b2fed commit ac96c8f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Expand Up @@ -7052,10 +7052,18 @@ struct AAValueConstantRangeImpl : AAValueConstantRange {
struct AAValueConstantRangeArgument final
: AAArgumentFromCallSiteArguments<
AAValueConstantRange, AAValueConstantRangeImpl, IntegerRangeState> {
AAValueConstantRangeArgument(const IRPosition &IRP)
: AAArgumentFromCallSiteArguments<
AAValueConstantRange, AAValueConstantRangeImpl, IntegerRangeState>(
IRP) {}
using Base = AAArgumentFromCallSiteArguments<
AAValueConstantRange, AAValueConstantRangeImpl, IntegerRangeState>;
AAValueConstantRangeArgument(const IRPosition &IRP) : Base(IRP) {}

/// See AbstractAttribute::initialize(..).
void initialize(Attributor &A) override {
if (!getAnchorScope() || getAnchorScope()->isDeclaration()) {
indicatePessimisticFixpoint();
} else {
Base::initialize(A);
}
}

/// See AbstractAttribute::trackStatistics()
void trackStatistics() const override {
Expand Down

0 comments on commit ac96c8f

Please sign in to comment.