2929using namespace llvm ;
3030namespace {
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
104102downcastI64toI32InsertExtractElements (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
144140class 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
167164private:
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