Skip to content

Extend CFG cleanup to simplify conditional and multiway branches #1124

@dnovillo

Description

@dnovillo

Transformations may leave conditional jumps that can be fully resolved at compile time. For example, constant propagation (#1102) transforms

%9 = OpIAdd %int %int_4 %int_3
%6 = OpSGreaterThan %bool %9 %int_3
     OpSelectionMerge %25 None
     OpBranchConditional %6 %22 %23

into

%9 = OpIAdd %int %int_4 %int_3
%6 = OpSGreaterThan %bool %int_7 %int_3
     OpSelectionMerge %25 None
     OpBranchConditional true %22 %23

CFG cleanup should straighten out that conditional into an unconditional branch, and perhaps even join the basic blocks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions