Skip to content

Commit a477435

Browse files
fixup! don't reduce if volatile
1 parent 6cfaaf8 commit a477435

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,13 @@ static bool isSupportedInstr(const MachineInstr &MI) {
762762
case RISCV::VLUXEI32_V:
763763
case RISCV::VLOXEI32_V:
764764
case RISCV::VLUXEI64_V:
765-
case RISCV::VLOXEI64_V:
765+
case RISCV::VLOXEI64_V: {
766+
for (const MachineMemOperand *MMO : MI.memoperands())
767+
if (MMO->isVolatile())
768+
return false;
769+
return true;
770+
}
771+
766772
// Vector Single-Width Integer Add and Subtract
767773
case RISCV::VADD_VI:
768774
case RISCV::VADD_VV:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
# RUN: llc %s -o - -mtriple=riscv64 -mattr=+v -run-pass=riscv-vl-optimizer -verify-machineinstrs | FileCheck %s
3+
4+
---
5+
name: vleN_v_volatile
6+
body: |
7+
bb.0:
8+
; CHECK-LABEL: name: vleN_v
9+
; CHECK: %x:vr = PseudoVLE8_V_M1 $noreg, $noreg, -1, 3 /* e8 */, 0 /* tu, mu */ :: (volatile load (<vscale x 1 x s64>))
10+
; CHECK-NEXT: %y:vr = PseudoVADD_VV_M1 $noreg, %x, $noreg, 1, 3 /* e8 */, 0 /* tu, mu */
11+
%x:vr = PseudoVLE8_V_M1 $noreg, $noreg, -1, 3 /* e8 */, 0 :: (volatile load (<vscale x 1 x s64>))
12+
%y:vr = PseudoVADD_VV_M1 $noreg, %x, $noreg, 1, 3 /* e8 */, 0
13+
...

0 commit comments

Comments
 (0)