Skip to content

Commit 3503181

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: ae212c4: Improve alignment calculation in constant coalescing
Use `computeKnownBits` to check the minimum alignment of a buffer offset.
1 parent 7e06a9d commit 3503181

File tree

3 files changed

+3
-64
lines changed

3 files changed

+3
-64
lines changed

IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ SPDX-License-Identifier: MIT
2020
#include "common/LLVMWarningsPush.hpp"
2121
#include "llvmWrapper/IR/DerivedTypes.h"
2222
#include "llvmWrapper/Support/Alignment.h"
23-
#include "llvm/Analysis/ValueTracking.h"
24-
#include "llvm/Support/KnownBits.h"
2523
#include "common/LLVMWarningsPop.hpp"
2624
#include "Probe/Assertion.h"
2725

@@ -634,12 +632,6 @@ bool ConstantCoalescing::CompareBufferBase(
634632
return false;
635633
}
636634

637-
bool ConstantCoalescing::IsDwordAligned(Value* val) const
638-
{
639-
KnownBits knownBits = computeKnownBits(val, *dataLayout);
640-
return knownBits.countMinTrailingZeros() >= 2;
641-
}
642-
643635
void ConstantCoalescing::MergeScatterLoad(Instruction* load,
644636
Value* bufIdxV, uint addrSpace,
645637
Value* eltIdxV, uint offsetInBytes,
@@ -656,8 +648,7 @@ void ConstantCoalescing::MergeScatterLoad(Instruction* load,
656648
// Current assumption is that a chunk start needs to be DWORD aligned. In
657649
// the future we can consider adding support for merging 4 bytes or
658650
// 2 i16s/halfs into a single non-aligned DWORD.
659-
const bool isDwordAligned = ((offsetInBytes % 4) == 0 &&
660-
(alignment >= 4 || eltIdxV == nullptr || IsDwordAligned(eltIdxV)));
651+
const bool isDwordAligned = ((offsetInBytes % 4) == 0 && (eltIdxV == nullptr || alignment >= 4));
661652

662653
BufChunk* cov_chunk = nullptr;
663654
for (std::vector<BufChunk*>::reverse_iterator rit = chunk_vec.rbegin(),
@@ -1063,8 +1054,8 @@ void ConstantCoalescing::MergeUniformLoad(Instruction* load,
10631054
// Current assumption is that a chunk start needs to be DWORD aligned. In
10641055
// the future we can consider adding support for merging 4 bytes or
10651056
// 2 i16s/halfs into a single non-aligned DWORD.
1066-
const bool isDwordAligned = ((offsetInBytes % 4) == 0 &&
1067-
(alignment >= 4 || eltIdxV == nullptr || IsDwordAligned(eltIdxV)));
1057+
const bool isDwordAligned =
1058+
((offsetInBytes % 4) == 0 && (eltIdxV == nullptr || alignment >= 4));
10681059

10691060
auto shouldMerge = [&](const BufChunk* cur_chunk)
10701061
{

IGC/Compiler/CISACodeGen/ConstantCoalescing.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ namespace IGC
303303
bool IsSamplerAlignedAddress(Value* addr) const;
304304
Value* GetSamplerAlignedAddress(Value* inst);
305305

306-
bool IsDwordAligned(Value* val) const;
307-
308306
alignment_t GetAlignment(Instruction* load) const;
309307
void SetAlignment(Instruction* load, uint alignment);
310308

IGC/Compiler/tests/ConstantCoalescing/ldraws-alinment.ll

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)