mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-04 16:26:46 +00:00
[Attributor] Use AssumptionCache in AANonNullFloating::initialize
This commit is contained in:
parent
1612d38241
commit
2c0edbf19c
@ -2032,15 +2032,18 @@ struct AANonNullFloating
|
||||
const DataLayout &DL = A.getDataLayout();
|
||||
|
||||
DominatorTree *DT = nullptr;
|
||||
AssumptionCache *AC = nullptr;
|
||||
InformationCache &InfoCache = A.getInfoCache();
|
||||
if (const Function *Fn = getAnchorScope())
|
||||
if (const Function *Fn = getAnchorScope()) {
|
||||
DT = InfoCache.getAnalysisResultForFunction<DominatorTreeAnalysis>(*Fn);
|
||||
AC = InfoCache.getAnalysisResultForFunction<AssumptionAnalysis>(*Fn);
|
||||
}
|
||||
|
||||
auto VisitValueCB = [&](Value &V, AANonNull::StateType &T,
|
||||
bool Stripped) -> bool {
|
||||
const auto &AA = A.getAAFor<AANonNull>(*this, IRPosition::value(V));
|
||||
if (!Stripped && this == &AA) {
|
||||
if (!isKnownNonZero(&V, DL, 0, /* TODO: AC */ nullptr, getCtxI(), DT))
|
||||
if (!isKnownNonZero(&V, DL, 0, AC, getCtxI(), DT))
|
||||
T.indicatePessimisticFixpoint();
|
||||
} else {
|
||||
// Use abstract attribute information.
|
||||
|
@ -119,8 +119,8 @@ define i8* @test9(i8* %a, i64 %n) {
|
||||
}
|
||||
|
||||
declare void @llvm.assume(i1)
|
||||
; FIXME: missing nonnull
|
||||
; ATTRIBUTOR: define i8* @test10
|
||||
; ATTRIBUTOR_OPM: define i8* @test10
|
||||
; ATTRIBUTOR_NPM: define nonnull i8* @test10
|
||||
define i8* @test10(i8* %a, i64 %n) {
|
||||
%cmp = icmp ne i64 %n, 0
|
||||
call void @llvm.assume(i1 %cmp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user