8
8
#include " slang-parameter-binding.h"
9
9
#include " slang-ir-legalize-image-subscript.h"
10
10
#include " slang-ir-legalize-varying-params.h"
11
- #include " slang-ir-simplify-cfg .h"
11
+ #include " slang-ir-sccp .h"
12
12
13
13
namespace Slang
14
14
{
@@ -17,9 +17,9 @@ namespace Slang
17
17
return as<IRImageSubscript>(getRootAddr (inst->getOperand (0 )));
18
18
}
19
19
20
- void legalizeIsTextureAccess (IRModule* module)
20
+ void legalizeIsTextureAccess (IRModule* module, DiagnosticSink* sink )
21
21
{
22
- HashSet<IRFunc*> functionsToSimplifyCFG ;
22
+ HashSet<IRFunc*> functionsToSCCP ;
23
23
IRBuilder builder (module);
24
24
for (auto globalInst : module->getModuleInst ()->getChildren ())
25
25
{
@@ -41,7 +41,7 @@ namespace Slang
41
41
else
42
42
{
43
43
inst->replaceUsesWith (builder.getBoolValue (false ));
44
- functionsToSimplifyCFG .add (func);
44
+ functionsToSCCP .add (func);
45
45
}
46
46
inst->removeAndDeallocate ();
47
47
continue ;
@@ -53,7 +53,7 @@ namespace Slang
53
53
else
54
54
{
55
55
inst->replaceUsesWith (builder.getBoolValue (false ));
56
- functionsToSimplifyCFG .add (func);
56
+ functionsToSCCP .add (func);
57
57
}
58
58
inst->removeAndDeallocate ();
59
59
continue ;
@@ -66,7 +66,7 @@ namespace Slang
66
66
else
67
67
{
68
68
inst->replaceUsesWith (builder.getBoolValue (false ));
69
- functionsToSimplifyCFG .add (func);
69
+ functionsToSCCP .add (func);
70
70
}
71
71
inst->removeAndDeallocate ();
72
72
continue ;
@@ -75,10 +75,11 @@ namespace Slang
75
75
}
76
76
}
77
77
}
78
- // Requires a simplifyCFG to ensure Slang does not evaluate 'IRTextureType' code path for
79
- // 'inst' for when 'inst' is not a 'IRTextureType'/TextureAccessor
80
- for (auto func : functionsToSimplifyCFG)
81
- simplifyCFG (func, CFGSimplificationOptions::getFast ());
78
+ // Requires a SCCP to ensure Slang does not evaluate 'IRTextureType' code path
79
+ // and unresolved 'isTextureAccess' operations for when 'inst' is not a
80
+ // 'IRTextureType'/`TextureAccessor`
81
+ for (auto func : functionsToSCCP)
82
+ applySparseConditionalConstantPropagation (func, sink);
82
83
}
83
84
}
84
85
0 commit comments