Skip to content

Commit ae10b8a

Browse files
committed
[Attributor][FIX] Give registered simplification callbacks precedence
We accidentally checked for constants before we looked for registered simplification callbacks. The latter needs to take precedence though.
1 parent 95141aa commit ae10b8a

File tree

2 files changed

+328
-2
lines changed

2 files changed

+328
-2
lines changed

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,6 @@ Optional<Constant *>
10251025
Attributor::getAssumedConstant(const IRPosition &IRP,
10261026
const AbstractAttribute &AA,
10271027
bool &UsedAssumedInformation) {
1028-
if (auto *C = dyn_cast<Constant>(&IRP.getAssociatedValue()))
1029-
return C;
10301028
// First check all callbacks provided by outside AAs. If any of them returns
10311029
// a non-null value that is different from the associated value, or None, we
10321030
// assume it's simplified.
@@ -1038,6 +1036,8 @@ Attributor::getAssumedConstant(const IRPosition &IRP,
10381036
return cast<Constant>(*SimplifiedV);
10391037
return nullptr;
10401038
}
1039+
if (auto *C = dyn_cast<Constant>(&IRP.getAssociatedValue()))
1040+
return C;
10411041
const auto &ValueSimplifyAA =
10421042
getAAFor<AAValueSimplify>(AA, IRP, DepClassTy::NONE);
10431043
Optional<Value *> SimplifiedV =

0 commit comments

Comments
 (0)