Skip to content

Commit ccbe953

Browse files
committed
address PR comment to hoist data structures and clear them in loops instead
1 parent 2002521 commit ccbe953

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Target/DirectX/DXILLegalizePass.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,11 @@ class DXILLegalizationPipeline {
569569

570570
bool runLegalizationPipeline(Function &F) {
571571
bool MadeChange = false;
572+
SmallVector<Instruction *> ToRemove;
573+
DenseMap<Value *, Value *> ReplacedValues;
572574
for (int Stage = 0; Stage < NumStages; ++Stage) {
573-
SmallVector<Instruction *> ToRemove;
574-
DenseMap<Value *, Value *> ReplacedValues;
575+
ToRemove.clear();
576+
ReplacedValues.clear();
575577
for (auto &I : instructions(F)) {
576578
for (auto &LegalizationFn : LegalizationPipeline[Stage])
577579
LegalizationFn(I, ToRemove, ReplacedValues);

0 commit comments

Comments
 (0)