-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0065-Xtensa-Correction-of-the-PSRAM-fix-pass.patch
102 lines (99 loc) · 3.89 KB
/
0065-Xtensa-Correction-of-the-PSRAM-fix-pass.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From 931628c899d0fc4a160cb5a083c25e2a84708042 Mon Sep 17 00:00:00 2001
From: Andrei Safronov <safronov@espressif.com>
Date: Wed, 5 Apr 2023 00:59:11 +0300
Subject: [PATCH 065/158] [Xtensa] Correction of the PSRAM fix pass
---
.../lib/Target/Xtensa/XtensaESP32PSRAMFix.cpp | 58 +++++++++++--------
1 file changed, 33 insertions(+), 25 deletions(-)
diff --git a/llvm/lib/Target/Xtensa/XtensaESP32PSRAMFix.cpp b/llvm/lib/Target/Xtensa/XtensaESP32PSRAMFix.cpp
index 5f22c2ea0e20..0c4433ed0012 100644
--- a/llvm/lib/Target/Xtensa/XtensaESP32PSRAMFix.cpp
+++ b/llvm/lib/Target/Xtensa/XtensaESP32PSRAMFix.cpp
@@ -223,14 +223,16 @@ bool createXtensaPSRAMCacheFix::xtensaPSRAMCacheFixMemwReorg(
case Xtensa::L16UI:
case Xtensa::L8UI:
if (StoreInsn) {
- MachineMemOperand *MMO = *MII->memoperands_begin();
- if (!MMO->isVolatile()) {
- DebugLoc dl = MII->getDebugLoc();
- const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
- BuildMI(MBB, MII, dl, NewMCID);
- Modified = true;
- StoreInsn = nullptr;
- NumAdded++;
+ if (!MII->memoperands_empty()) {
+ MachineMemOperand *MMO = *MII->memoperands_begin();
+ if (!MMO->isVolatile()) {
+ DebugLoc dl = MII->getDebugLoc();
+ const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
+ BuildMI(MBB, MII, dl, NewMCID);
+ Modified = true;
+ StoreInsn = nullptr;
+ NumAdded++;
+ }
}
}
if (LastHIQIStore) {
@@ -251,9 +253,11 @@ bool createXtensaPSRAMCacheFix::xtensaPSRAMCacheFixMemwReorg(
} break;
case Xtensa::S16I:
case Xtensa::S8I: {
- MachineMemOperand *MMO = *MII->memoperands_begin();
- if (!MMO->isVolatile()) {
- LastHIQIStore = MI;
+ if (!MII->memoperands_empty()) {
+ MachineMemOperand *MMO = *MII->memoperands_begin();
+ if (!MMO->isVolatile()) {
+ LastHIQIStore = MI;
+ }
}
StoreInsn = MI;
} break;
@@ -292,13 +296,15 @@ bool createXtensaPSRAMCacheFix::xtensaInsertMemwReorg(MachineFunction &MF) {
case Xtensa::L16SI:
case Xtensa::L16UI:
case Xtensa::L8UI: {
- MachineMemOperand *MMO = *MII->memoperands_begin();
- if (!MMO->isVolatile() && (!HadMemw)) {
- DebugLoc dl = MII->getDebugLoc();
- const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
- BuildMI(MBB, MII, dl, NewMCID);
- Modified = true;
- NumAdded++;
+ if (!MII->memoperands_empty()) {
+ MachineMemOperand *MMO = *MII->memoperands_begin();
+ if (!MMO->isVolatile() && (!HadMemw)) {
+ DebugLoc dl = MII->getDebugLoc();
+ const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
+ BuildMI(MBB, MII, dl, NewMCID);
+ Modified = true;
+ NumAdded++;
+ }
}
HadMemw = false;
} break;
@@ -307,13 +313,15 @@ bool createXtensaPSRAMCacheFix::xtensaInsertMemwReorg(MachineFunction &MF) {
case Xtensa::S32I:
case Xtensa::S16I:
case Xtensa::S8I: {
- MachineMemOperand *MMO = *MII->memoperands_begin();
- if (!MMO->isVolatile()) {
- DebugLoc dl = MII->getDebugLoc();
- const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
- BuildMI(MBB, NextMII, dl, NewMCID);
- Modified = true;
- NumAdded++;
+ if (!MII->memoperands_empty()) {
+ MachineMemOperand *MMO = *MII->memoperands_begin();
+ if (!MMO->isVolatile()) {
+ DebugLoc dl = MII->getDebugLoc();
+ const MCInstrDesc &NewMCID = XtensaII->get(Xtensa::MEMW);
+ BuildMI(MBB, NextMII, dl, NewMCID);
+ Modified = true;
+ NumAdded++;
+ }
}
HadMemw = true;
} break;
--
2.40.1