mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Revert "[Attributor] Disable simplification AAs if a callback is present"
This reverts commit cbb709e25124dc38ee593882051fc88c987fe591 as it breaks the tests, which was not supposed to happen. Investigating now.
This commit is contained in:
parent
0042081f58
commit
96f821bd7b
@ -1563,11 +1563,6 @@ struct Attributor {
|
|||||||
SimplificationCallbacks[IRP].emplace_back(CB);
|
SimplificationCallbacks[IRP].emplace_back(CB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if there is a simplification callback for \p IRP.
|
|
||||||
bool hasSimplificationCallback(const IRPosition &IRP) {
|
|
||||||
return SimplificationCallbacks.count(IRP);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The vector with all simplification callbacks registered by outside AAs.
|
/// The vector with all simplification callbacks registered by outside AAs.
|
||||||
DenseMap<IRPosition, SmallVector<SimplifictionCallbackTy, 1>>
|
DenseMap<IRPosition, SmallVector<SimplifictionCallbackTy, 1>>
|
||||||
|
@ -5067,8 +5067,6 @@ struct AAValueSimplifyImpl : AAValueSimplify {
|
|||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
if (getAssociatedValue().getType()->isVoidTy())
|
if (getAssociatedValue().getType()->isVoidTy())
|
||||||
indicatePessimisticFixpoint();
|
indicatePessimisticFixpoint();
|
||||||
if (A.hasSimplificationCallback(getIRPosition()))
|
|
||||||
indicatePessimisticFixpoint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See AbstractAttribute::getAsStr().
|
/// See AbstractAttribute::getAsStr().
|
||||||
@ -5402,7 +5400,9 @@ struct AAValueSimplifyFloating : AAValueSimplifyImpl {
|
|||||||
|
|
||||||
/// See AbstractAttribute::initialize(...).
|
/// See AbstractAttribute::initialize(...).
|
||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
AAValueSimplifyImpl::initialize(A);
|
// FIXME: This might have exposed a SCC iterator update bug in the old PM.
|
||||||
|
// Needs investigation.
|
||||||
|
// AAValueSimplifyImpl::initialize(A);
|
||||||
Value &V = getAnchorValue();
|
Value &V = getAnchorValue();
|
||||||
|
|
||||||
// TODO: add other stuffs
|
// TODO: add other stuffs
|
||||||
@ -5639,7 +5639,6 @@ struct AAValueSimplifyCallSiteReturned : AAValueSimplifyImpl {
|
|||||||
: AAValueSimplifyImpl(IRP, A) {}
|
: AAValueSimplifyImpl(IRP, A) {}
|
||||||
|
|
||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
AAValueSimplifyImpl::initialize(A);
|
|
||||||
if (!getAssociatedFunction())
|
if (!getAssociatedFunction())
|
||||||
indicatePessimisticFixpoint();
|
indicatePessimisticFixpoint();
|
||||||
}
|
}
|
||||||
@ -7889,20 +7888,6 @@ struct AAValueConstantRangeImpl : AAValueConstantRange {
|
|||||||
AAValueConstantRangeImpl(const IRPosition &IRP, Attributor &A)
|
AAValueConstantRangeImpl(const IRPosition &IRP, Attributor &A)
|
||||||
: AAValueConstantRange(IRP, A) {}
|
: AAValueConstantRange(IRP, A) {}
|
||||||
|
|
||||||
/// See AbstractAttribute::initialize(..).
|
|
||||||
void initialize(Attributor &A) override {
|
|
||||||
if (A.hasSimplificationCallback(getIRPosition())) {
|
|
||||||
indicatePessimisticFixpoint();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intersect a range given by SCEV.
|
|
||||||
intersectKnown(getConstantRangeFromSCEV(A, getCtxI()));
|
|
||||||
|
|
||||||
// Intersect a range given by LVI.
|
|
||||||
intersectKnown(getConstantRangeFromLVI(A, getCtxI()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See AbstractAttribute::getAsStr().
|
/// See AbstractAttribute::getAsStr().
|
||||||
const std::string getAsStr() const override {
|
const std::string getAsStr() const override {
|
||||||
std::string Str;
|
std::string Str;
|
||||||
@ -8034,6 +8019,15 @@ struct AAValueConstantRangeImpl : AAValueConstantRange {
|
|||||||
return getAssumed().intersectWith(SCEVR).intersectWith(LVIR);
|
return getAssumed().intersectWith(SCEVR).intersectWith(LVIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// See AbstractAttribute::initialize(..).
|
||||||
|
void initialize(Attributor &A) override {
|
||||||
|
// Intersect a range given by SCEV.
|
||||||
|
intersectKnown(getConstantRangeFromSCEV(A, getCtxI()));
|
||||||
|
|
||||||
|
// Intersect a range given by LVI.
|
||||||
|
intersectKnown(getConstantRangeFromLVI(A, getCtxI()));
|
||||||
|
}
|
||||||
|
|
||||||
/// Helper function to create MDNode for range metadata.
|
/// Helper function to create MDNode for range metadata.
|
||||||
static MDNode *
|
static MDNode *
|
||||||
getMDNodeForConstantRange(Type *Ty, LLVMContext &Ctx,
|
getMDNodeForConstantRange(Type *Ty, LLVMContext &Ctx,
|
||||||
@ -8163,9 +8157,6 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
|
|||||||
/// See AbstractAttribute::initialize(...).
|
/// See AbstractAttribute::initialize(...).
|
||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
AAValueConstantRangeImpl::initialize(A);
|
AAValueConstantRangeImpl::initialize(A);
|
||||||
if (isAtFixpoint())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Value &V = getAssociatedValue();
|
Value &V = getAssociatedValue();
|
||||||
|
|
||||||
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
||||||
@ -8186,7 +8177,6 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
|
|||||||
|
|
||||||
if (isa<BinaryOperator>(&V) || isa<CmpInst>(&V) || isa<CastInst>(&V))
|
if (isa<BinaryOperator>(&V) || isa<CmpInst>(&V) || isa<CastInst>(&V))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If it is a load instruction with range metadata, use it.
|
// If it is a load instruction with range metadata, use it.
|
||||||
if (LoadInst *LI = dyn_cast<LoadInst>(&V))
|
if (LoadInst *LI = dyn_cast<LoadInst>(&V))
|
||||||
if (auto *RangeMD = LI->getMetadata(LLVMContext::MD_range)) {
|
if (auto *RangeMD = LI->getMetadata(LLVMContext::MD_range)) {
|
||||||
@ -8514,14 +8504,6 @@ struct AAPotentialValuesImpl : AAPotentialValues {
|
|||||||
AAPotentialValuesImpl(const IRPosition &IRP, Attributor &A)
|
AAPotentialValuesImpl(const IRPosition &IRP, Attributor &A)
|
||||||
: AAPotentialValues(IRP, A) {}
|
: AAPotentialValues(IRP, A) {}
|
||||||
|
|
||||||
/// See AbstractAttribute::initialize(..).
|
|
||||||
void initialize(Attributor &A) override {
|
|
||||||
if (A.hasSimplificationCallback(getIRPosition()))
|
|
||||||
indicatePessimisticFixpoint();
|
|
||||||
else
|
|
||||||
AAPotentialValues::initialize(A);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See AbstractAttribute::getAsStr().
|
/// See AbstractAttribute::getAsStr().
|
||||||
const std::string getAsStr() const override {
|
const std::string getAsStr() const override {
|
||||||
std::string Str;
|
std::string Str;
|
||||||
@ -8579,10 +8561,6 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
|
|||||||
|
|
||||||
/// See AbstractAttribute::initialize(..).
|
/// See AbstractAttribute::initialize(..).
|
||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
AAPotentialValuesImpl::initialize(A);
|
|
||||||
if (isAtFixpoint())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Value &V = getAssociatedValue();
|
Value &V = getAssociatedValue();
|
||||||
|
|
||||||
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
||||||
@ -9115,10 +9093,6 @@ struct AAPotentialValuesCallSiteArgument : AAPotentialValuesFloating {
|
|||||||
|
|
||||||
/// See AbstractAttribute::initialize(..).
|
/// See AbstractAttribute::initialize(..).
|
||||||
void initialize(Attributor &A) override {
|
void initialize(Attributor &A) override {
|
||||||
AAPotentialValuesImpl::initialize(A);
|
|
||||||
if (isAtFixpoint())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Value &V = getAssociatedValue();
|
Value &V = getAssociatedValue();
|
||||||
|
|
||||||
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
if (auto *C = dyn_cast<ConstantInt>(&V)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user