Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class LLVM_ABI GISelValueTracking : public GISelChangeObserver {
const TargetLowering &TL;
const DataLayout &DL;
unsigned MaxDepth;
/// Cache maintained during a computeKnownBits request.
SmallDenseMap<Register, KnownBits, 16> ComputeKnownBitsCache;

void computeKnownBitsMin(Register Src0, Register Src1, KnownBits &Known,
const APInt &DemandedElts, unsigned Depth = 0);
Expand Down
25 changes: 0 additions & 25 deletions llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ KnownBits GISelValueTracking::getKnownBits(Register R) {
KnownBits GISelValueTracking::getKnownBits(Register R,
const APInt &DemandedElts,
unsigned Depth) {
// For now, we only maintain the cache during one request.
assert(ComputeKnownBitsCache.empty() && "Cache should have been cleared");

KnownBits Known;
computeKnownBitsImpl(R, Known, DemandedElts, Depth);
ComputeKnownBitsCache.clear();
return Known;
}

Expand Down Expand Up @@ -187,14 +183,6 @@ void GISelValueTracking::computeKnownBitsImpl(Register R, KnownBits &Known,
#endif

unsigned BitWidth = DstTy.getScalarSizeInBits();
auto CacheEntry = ComputeKnownBitsCache.find(R);
if (CacheEntry != ComputeKnownBitsCache.end()) {
Known = CacheEntry->second;
LLVM_DEBUG(dbgs() << "Cache hit at ");
LLVM_DEBUG(dumpResult(MI, Known, Depth));
assert(Known.getBitWidth() == BitWidth && "Cache entry size doesn't match");
return;
}
Known = KnownBits(BitWidth); // Don't know anything

// Depth may get bigger than max depth if it gets passed to a different
Expand Down Expand Up @@ -254,16 +242,6 @@ void GISelValueTracking::computeKnownBitsImpl(Register R, KnownBits &Known,
// point of the pipeline, otherwise the main live-range will be
// defined more than once, which is against SSA.
assert(MI.getOperand(0).getSubReg() == 0 && "Is this code in SSA?");
// Record in the cache that we know nothing for MI.
// This will get updated later and in the meantime, if we reach that
// phi again, because of a loop, we will cut the search thanks to this
// cache entry.
// We could actually build up more information on the phi by not cutting
// the search, but that additional information is more a side effect
// than an intended choice.
// Therefore, for now, save on compile time until we derive a proper way
// to derive known bits for PHIs within loops.
ComputeKnownBitsCache[R] = KnownBits(BitWidth);
// PHI's operand are a mix of registers and basic blocks interleaved.
// We only care about the register ones.
for (unsigned Idx = 1; Idx < MI.getNumOperands(); Idx += 2) {
Expand Down Expand Up @@ -700,9 +678,6 @@ void GISelValueTracking::computeKnownBitsImpl(Register R, KnownBits &Known,
}

LLVM_DEBUG(dumpResult(MI, Known, Depth));

// Update the cache.
ComputeKnownBitsCache[R] = Known;
}

static bool outputDenormalIsIEEEOrPosZero(const MachineFunction &MF, LLT Ty) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/AArch64/rem-by-const.ll
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ define i8 @ui8_7(i8 %a, i8 %b) {
; CHECK-GI-NEXT: sub w9, w0, w8
; CHECK-GI-NEXT: ubfx w9, w9, #1, #7
; CHECK-GI-NEXT: add w8, w9, w8
; CHECK-GI-NEXT: ubfx w8, w8, #2, #6
; CHECK-GI-NEXT: lsr w8, w8, #2
; CHECK-GI-NEXT: lsl w9, w8, #3
; CHECK-GI-NEXT: sub w8, w9, w8
; CHECK-GI-NEXT: sub w0, w0, w8
Expand Down Expand Up @@ -207,7 +207,7 @@ define i16 @ui16_7(i16 %a, i16 %b) {
; CHECK-GI-NEXT: sub w9, w0, w8
; CHECK-GI-NEXT: ubfx w9, w9, #1, #15
; CHECK-GI-NEXT: add w8, w9, w8
; CHECK-GI-NEXT: ubfx w8, w8, #2, #14
; CHECK-GI-NEXT: lsr w8, w8, #2
; CHECK-GI-NEXT: lsl w9, w8, #3
; CHECK-GI-NEXT: sub w8, w9, w8
; CHECK-GI-NEXT: sub w0, w0, w8
Expand Down
Loading