Skip to content

Commit 4e4811a

Browse files
authored
Merge pull request #854 from hvdijk/avoid-computeknownbits
[LLVM 21] Avoid computeKnownBits.
2 parents b347adf + 0101b4f commit 4e4811a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

modules/compiler/vecz/source/offset_info.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <compiler/utils/builtin_info.h>
2020
#include <llvm/Analysis/ValueTracking.h>
21+
#include <llvm/Analysis/WithCache.h>
2122
#include <llvm/IR/Constants.h>
2223
#include <llvm/IR/Instructions.h>
2324
#include <llvm/IR/Module.h>
@@ -177,8 +178,10 @@ OffsetInfo &OffsetInfo::analyze(Value *Offset, StrideAnalysisResult &SAR) {
177178

178179
// If we have a uniform value here we don't need to analyse any further.
179180
if (!SAR.UVR.isVarying(Ins)) {
180-
const auto &KB =
181-
computeKnownBits(Ins, SAR.F.getParent()->getDataLayout(), 0, &SAR.AC);
181+
SimplifyQuery SQ(SAR.F.getParent()->getDataLayout());
182+
SQ.AC = &SAR.AC;
183+
const WithCache<Instruction *> InsWithCache(Ins);
184+
const auto &KB = InsWithCache.getKnownBits(SQ);
182185
const auto bitWidth = OffsetTy->getIntegerBitWidth();
183186

184187
// We are interested in the bits that are not known to be zero.

0 commit comments

Comments
 (0)