@@ -1712,9 +1712,11 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeFlatStorePair(
1712
1712
}
1713
1713
1714
1714
static bool needsConstrainedOpcode (const GCNSubtarget &STM,
1715
- const MachineMemOperand *MMO ,
1715
+ ArrayRef< MachineMemOperand *> MMOs ,
1716
1716
unsigned Width) {
1717
- return STM.isXNACKEnabled () && MMO->getAlign ().value () < Width * 4 ;
1717
+ // Conservatively returns true if not found the MMO.
1718
+ return STM.isXNACKEnabled () &&
1719
+ (MMOs.size () != 1 || MMOs[0 ]->getAlign ().value () < Width * 4 );
1718
1720
}
1719
1721
1720
1722
unsigned SILoadStoreOptimizer::getNewOpcode (const CombineInfo &CI,
@@ -1737,8 +1739,8 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1737
1739
case S_BUFFER_LOAD_IMM: {
1738
1740
// If XNACK is enabled, use the constrained opcodes when the first load is
1739
1741
// under-aligned.
1740
- const MachineMemOperand *MMO = *CI. I -> memoperands_begin ();
1741
- bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO , Width);
1742
+ bool NeedsConstrainedOpc =
1743
+ needsConstrainedOpcode (*STM, CI. I -> memoperands () , Width);
1742
1744
switch (Width) {
1743
1745
default :
1744
1746
return 0 ;
@@ -1759,8 +1761,8 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1759
1761
case S_BUFFER_LOAD_SGPR_IMM: {
1760
1762
// If XNACK is enabled, use the constrained opcodes when the first load is
1761
1763
// under-aligned.
1762
- const MachineMemOperand *MMO = *CI. I -> memoperands_begin ();
1763
- bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO , Width);
1764
+ bool NeedsConstrainedOpc =
1765
+ needsConstrainedOpcode (*STM, CI. I -> memoperands () , Width);
1764
1766
switch (Width) {
1765
1767
default :
1766
1768
return 0 ;
@@ -1781,8 +1783,8 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1781
1783
case S_LOAD_IMM: {
1782
1784
// If XNACK is enabled, use the constrained opcodes when the first load is
1783
1785
// under-aligned.
1784
- const MachineMemOperand *MMO = *CI. I -> memoperands_begin ();
1785
- bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO , Width);
1786
+ bool NeedsConstrainedOpc =
1787
+ needsConstrainedOpcode (*STM, CI. I -> memoperands () , Width);
1786
1788
switch (Width) {
1787
1789
default :
1788
1790
return 0 ;
0 commit comments