Skip to content

Commit f8be37f

Browse files
committed
address pr comments
1 parent cbbdd62 commit f8be37f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Target/DirectX/DXILLegalizePass.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
using namespace llvm;
3030
namespace {
3131

32-
static bool fixI8TruncUseChain(Instruction &I,
32+
static void fixI8TruncUseChain(Instruction &I,
3333
std::stack<Instruction *> &ToRemove,
3434
std::map<Value *, Value *> &ReplacedValues) {
3535

@@ -96,11 +96,9 @@ static bool fixI8TruncUseChain(Instruction &I,
9696
Cast->replaceAllUsesWith(ReplacedValues[Cast->getOperand(0)]);
9797
}
9898
}
99-
100-
return !ToRemove.empty();
10199
}
102100

103-
static bool
101+
static void
104102
downcastI64toI32InsertExtractElements(Instruction &I,
105103
std::stack<Instruction *> &ToRemove,
106104
std::map<Value *, Value *> &) {
@@ -137,8 +135,6 @@ downcastI64toI32InsertExtractElements(Instruction &I,
137135
ToRemove.push(Insert);
138136
}
139137
}
140-
141-
return !ToRemove.empty();
142138
}
143139

144140
class DXILLegalizationPipeline {
@@ -149,12 +145,13 @@ class DXILLegalizationPipeline {
149145
bool runLegalizationPipeline(Function &F) {
150146
std::stack<Instruction *> ToRemove;
151147
std::map<Value *, Value *> ReplacedValues;
152-
bool MadeChanges = false;
153148
for (auto &I : instructions(F)) {
154149
for (auto &LegalizationFn : LegalizationPipeline) {
155-
MadeChanges |= LegalizationFn(I, ToRemove, ReplacedValues);
150+
LegalizationFn(I, ToRemove, ReplacedValues);
156151
}
157152
}
153+
bool MadeChanges = !ToRemove.empty();
154+
158155
while (!ToRemove.empty()) {
159156
Instruction *I = ToRemove.top();
160157
I->eraseFromParent();
@@ -165,7 +162,7 @@ class DXILLegalizationPipeline {
165162
}
166163

167164
private:
168-
std::vector<std::function<bool(Instruction &, std::stack<Instruction *> &,
165+
std::vector<std::function<void(Instruction &, std::stack<Instruction *> &,
169166
std::map<Value *, Value *> &)>>
170167
LegalizationPipeline;
171168

0 commit comments

Comments
 (0)