diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-07 18:36:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-07 18:36:35 -0800 |
| commit | 4be623c52a6518eb86756a0369706c1d6670f6bb (patch) | |
| tree | c24f54e34db9f1f02c2d51808b15121eba9195a9 /source/slang/slang-ir-dce.cpp | |
| parent | 101f164b036d0c1c012243df69179559b6f40fb8 (diff) | |
Arithmetic simplifications and more IR clean up logic. (#2632)
Diffstat (limited to 'source/slang/slang-ir-dce.cpp')
| -rw-r--r-- | source/slang/slang-ir-dce.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/slang/slang-ir-dce.cpp b/source/slang/slang-ir-dce.cpp index 33e5b3cb4..337caa246 100644 --- a/source/slang/slang-ir-dce.cpp +++ b/source/slang/slang-ir-dce.cpp @@ -3,6 +3,7 @@ #include "slang-ir.h" #include "slang-ir-insts.h" +#include "slang-ir-util.h" namespace Slang { @@ -16,6 +17,7 @@ struct DeadCodeEliminationContext // `eliminateDeadCode` function. // IRModule* module; + IRDeadCodeEliminationOptions options; // If we removed an inst, there may be still "weak references" to the inst. @@ -129,6 +131,9 @@ struct DeadCodeEliminationContext auto inst = workList.getLast(); workList.removeLast(); + if (!isChildInstOf(inst, root)) + continue; + // At this point we know that `inst` is live, // and we want to start considering which other // instructions must be live because of that @@ -426,7 +431,6 @@ bool eliminateDeadCode( DeadCodeEliminationContext context; context.module = module; context.options = options; - return context.processModule(); } @@ -437,7 +441,6 @@ bool eliminateDeadCode( DeadCodeEliminationContext context; context.module = root->getModule(); context.options = options; - return context.processInst(root); } |
