@@ -1735,8 +1735,10 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1735
1735
case UNKNOWN:
1736
1736
llvm_unreachable (" Unknown instruction class" );
1737
1737
case S_BUFFER_LOAD_IMM: {
1738
+ // If XNACK is enabled, use the constrained opcodes when the first load is
1739
+ // under-aligned.
1738
1740
const MachineMemOperand *MMO = *CI.I ->memoperands_begin ();
1739
- bool NeedsConstrainedOpc = needsConstrainedOpcode (*STM, MMO, Width);
1741
+ bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO, Width);
1740
1742
switch (Width) {
1741
1743
default :
1742
1744
return 0 ;
@@ -1755,8 +1757,10 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1755
1757
}
1756
1758
}
1757
1759
case S_BUFFER_LOAD_SGPR_IMM: {
1760
+ // If XNACK is enabled, use the constrained opcodes when the first load is
1761
+ // under-aligned.
1758
1762
const MachineMemOperand *MMO = *CI.I ->memoperands_begin ();
1759
- bool NeedsConstrainedOpc = needsConstrainedOpcode (*STM, MMO, Width);
1763
+ bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO, Width);
1760
1764
switch (Width) {
1761
1765
default :
1762
1766
return 0 ;
@@ -1778,7 +1782,7 @@ unsigned SILoadStoreOptimizer::getNewOpcode(const CombineInfo &CI,
1778
1782
// If XNACK is enabled, use the constrained opcodes when the first load is
1779
1783
// under-aligned.
1780
1784
const MachineMemOperand *MMO = *CI.I ->memoperands_begin ();
1781
- bool NeedsConstrainedOpc = needsConstrainedOpcode (*STM, MMO, Width);
1785
+ bool NeedsConstrainedOpc = MMO && needsConstrainedOpcode (*STM, MMO, Width);
1782
1786
switch (Width) {
1783
1787
default :
1784
1788
return 0 ;
0 commit comments