Skip to content

Commit

Permalink
Added additional LoadFieldAddress optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rs-mt committed Apr 25, 2020
1 parent bd2ec8b commit d7cb589
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Src/ILGPU/IR/Construction/Memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ public ValueReference CreateLoadFieldAddress(Value source, FieldSpan fieldSpan)

// Simplify pseudo-structure accesses
if (!pointerType.ElementType.IsStructureType && fieldSpan.Span < 2)
{
return source;
}
else if (pointerType.ElementType is StructureType structureType &&
fieldSpan.Index == 0 && structureType.NumFields == fieldSpan.Span)
{
return source;
}

// Fold nested field addresses
return source is LoadFieldAddress lfa
Expand Down

0 comments on commit d7cb589

Please sign in to comment.