@@ -3821,36 +3821,34 @@ class ArrayExprLowering {
3821
3821
3822
3822
// Handle the negated conditions. See 10.2.3.2p4 as to why this control
3823
3823
// structure is produced.
3824
- auto masks = implicitSpace->getMasks ();
3825
- for (auto maskExprs : masks) {
3826
- const auto size = maskExprs.size () - 1 ;
3827
- for (std::remove_const_t <decltype (size)> i = 0 ; i < size; ++i)
3828
- if (maskExprs[i]) {
3829
- auto ifOp = builder.create <fir::IfOp>(
3830
- loc, mlir::TypeRange{innerArg.getType ()},
3831
- fir::getBase (genCond (
3832
- implicitSpace->getBindingWithShape (maskExprs[i]), iters)),
3833
- /* withElseRegion=*/ true );
3834
- builder.create <fir::ResultOp>(loc, ifOp.getResult (0 ));
3835
- builder.setInsertionPointToStart (&ifOp.thenRegion ().front ());
3836
- builder.create <fir::ResultOp>(loc, innerArg);
3837
- builder.setInsertionPointToStart (&ifOp.elseRegion ().front ());
3838
- }
3839
-
3840
- // The last condition is either non-negated or unconditionally negated.
3841
- if (maskExprs[size]) {
3824
+ auto maskExprs = implicitSpace->getExprs ();
3825
+ const auto size = maskExprs.size () - 1 ;
3826
+ for (std::remove_const_t <decltype (size)> i = 0 ; i < size; ++i)
3827
+ if (maskExprs[i]) {
3842
3828
auto ifOp = builder.create <fir::IfOp>(
3843
3829
loc, mlir::TypeRange{innerArg.getType ()},
3844
3830
fir::getBase (genCond (
3845
- implicitSpace->getBindingWithShape (maskExprs[size ]), iters)),
3831
+ implicitSpace->getBindingWithShape (maskExprs[i ]), iters)),
3846
3832
/* withElseRegion=*/ true );
3847
3833
builder.create <fir::ResultOp>(loc, ifOp.getResult (0 ));
3848
- builder.setInsertionPointToStart (&ifOp.elseRegion ().front ());
3849
- builder.create <fir::ResultOp>(loc, innerArg);
3850
3834
builder.setInsertionPointToStart (&ifOp.thenRegion ().front ());
3851
- } else {
3852
- // do nothing
3835
+ builder. create <fir::ResultOp>(loc, innerArg);
3836
+ builder. setInsertionPointToStart (&ifOp. elseRegion (). front ());
3853
3837
}
3838
+
3839
+ // The last condition is either non-negated or unconditionally negated.
3840
+ if (maskExprs[size]) {
3841
+ auto ifOp = builder.create <fir::IfOp>(
3842
+ loc, mlir::TypeRange{innerArg.getType ()},
3843
+ fir::getBase (genCond (
3844
+ implicitSpace->getBindingWithShape (maskExprs[size]), iters)),
3845
+ /* withElseRegion=*/ true );
3846
+ builder.create <fir::ResultOp>(loc, ifOp.getResult (0 ));
3847
+ builder.setInsertionPointToStart (&ifOp.elseRegion ().front ());
3848
+ builder.create <fir::ResultOp>(loc, innerArg);
3849
+ builder.setInsertionPointToStart (&ifOp.thenRegion ().front ());
3850
+ } else {
3851
+ // do nothing
3854
3852
}
3855
3853
}
3856
3854
0 commit comments