Skip to content

Commit 55dae6e

Browse files
jgu222igcbot
authored andcommitted
Minor refactoring
Add sanity check to make sure the element type of stored value has power of 2 size in byte; otherwise skip. Expect no functional change.
1 parent 2aa1de2 commit 55dae6e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

IGC/Compiler/CISACodeGen/MemOpt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,12 @@ void LdStCombine::combineStores(Function& F)
30343034
{
30353035
if (StoreInst* SI = dyn_cast<StoreInst>(I))
30363036
{
3037+
// Sanity check
3038+
Type* eTy = SI->getValueOperand()->getType()->getScalarType();
3039+
if (!isPowerOf2_32((uint32_t)m_DL->getTypeStoreSize(eTy))) {
3040+
return false;
3041+
}
3042+
30373043
// Only original, not-yet-visited store can be candidates.
30383044
bool isOrigSt = (m_instOrder.size() == 0 ||
30393045
m_instOrder.count(I) > 0);

0 commit comments

Comments
 (0)