29
29
using namespace llvm ;
30
30
namespace {
31
31
32
- static bool fixI8TruncUseChain (Instruction &I,
32
+ static void fixI8TruncUseChain (Instruction &I,
33
33
std::stack<Instruction *> &ToRemove,
34
34
std::map<Value *, Value *> &ReplacedValues) {
35
35
@@ -96,11 +96,9 @@ static bool fixI8TruncUseChain(Instruction &I,
96
96
Cast->replaceAllUsesWith (ReplacedValues[Cast->getOperand (0 )]);
97
97
}
98
98
}
99
-
100
- return !ToRemove.empty ();
101
99
}
102
100
103
- static bool
101
+ static void
104
102
downcastI64toI32InsertExtractElements (Instruction &I,
105
103
std::stack<Instruction *> &ToRemove,
106
104
std::map<Value *, Value *> &) {
@@ -137,8 +135,6 @@ downcastI64toI32InsertExtractElements(Instruction &I,
137
135
ToRemove.push (Insert);
138
136
}
139
137
}
140
-
141
- return !ToRemove.empty ();
142
138
}
143
139
144
140
class DXILLegalizationPipeline {
@@ -149,12 +145,13 @@ class DXILLegalizationPipeline {
149
145
bool runLegalizationPipeline (Function &F) {
150
146
std::stack<Instruction *> ToRemove;
151
147
std::map<Value *, Value *> ReplacedValues;
152
- bool MadeChanges = false ;
153
148
for (auto &I : instructions (F)) {
154
149
for (auto &LegalizationFn : LegalizationPipeline) {
155
- MadeChanges |= LegalizationFn (I, ToRemove, ReplacedValues);
150
+ LegalizationFn (I, ToRemove, ReplacedValues);
156
151
}
157
152
}
153
+ bool MadeChanges = !ToRemove.empty ();
154
+
158
155
while (!ToRemove.empty ()) {
159
156
Instruction *I = ToRemove.top ();
160
157
I->eraseFromParent ();
@@ -165,7 +162,7 @@ class DXILLegalizationPipeline {
165
162
}
166
163
167
164
private:
168
- std::vector<std::function<bool (Instruction &, std::stack<Instruction *> &,
165
+ std::vector<std::function<void (Instruction &, std::stack<Instruction *> &,
169
166
std::map<Value *, Value *> &)>>
170
167
LegalizationPipeline;
171
168
0 commit comments