Skip to content

Commit

Permalink
Move definition of vhloOperands right before it is used (#1920)
Browse files Browse the repository at this point in the history
This makes the code a bit more readable. On my first read I was puzzled
as to why this getter was being called.
  • Loading branch information
mlevesquedion authored Jan 16, 2024
1 parent 2a79b7c commit 9c8a1b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stablehlo/transforms/StablehloLegalizeToVhlo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,6 @@ class StablehloToVhloOpConverter : public OpConversionPattern<StablehloOpTy> {
return failure();
}

// These operands have already been converted to VHLO by
// the dialect conversion infrastructure.
ValueRange vhloOperands = adaptor.getOperands();

// Convert StableHLO attributes to VHLO equivalents.
// There are two paths:
// 1) Generic path where default logic applies, and there is a 1:1
Expand All @@ -821,6 +817,10 @@ class StablehloToVhloOpConverter : public OpConversionPattern<StablehloOpTy> {
}
}

// These operands have already been converted to VHLO by
// the dialect conversion infrastructure.
ValueRange vhloOperands = adaptor.getOperands();

// Convert the StableHLO operation to a VHLO equivalent.
// This can almost be done in a generic fashion, except for
// stablehlo.case that uses a variadic number of regions which means an
Expand Down

0 comments on commit 9c8a1b7

Please sign in to comment.