From 9c8a1b7ddd5e4ef5abbdc7ef33b041a56343ae2f Mon Sep 17 00:00:00 2001 From: mlevesquedion Date: Tue, 16 Jan 2024 15:44:48 -0800 Subject: [PATCH] Move definition of vhloOperands right before it is used (#1920) This makes the code a bit more readable. On my first read I was puzzled as to why this getter was being called. --- stablehlo/transforms/StablehloLegalizeToVhlo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stablehlo/transforms/StablehloLegalizeToVhlo.cpp b/stablehlo/transforms/StablehloLegalizeToVhlo.cpp index c61ba027a74..e8e8623645f 100644 --- a/stablehlo/transforms/StablehloLegalizeToVhlo.cpp +++ b/stablehlo/transforms/StablehloLegalizeToVhlo.cpp @@ -792,10 +792,6 @@ class StablehloToVhloOpConverter : public OpConversionPattern { 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 @@ -821,6 +817,10 @@ class StablehloToVhloOpConverter : public OpConversionPattern { } } + // 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