Avoid making order of C++ arg evaluation influence generated IR

This looks like a footgun, is there a way to systematically smoke bugs like
these out?

This one was pretty benign, but I can imagine more serious instances of this.

PiperOrigin-RevId: 352485514
Change-Id: I7f9629a21847817cc40b0381c9e1a9f9b08fcd18
This commit is contained in:
Sanjoy Das 2021-01-18 20:27:19 -08:00 committed by TensorFlower Gardener
parent 4fcfcbe2c6
commit b459be827a
2 changed files with 3 additions and 5 deletions

View File

@ -61,9 +61,6 @@ cc_library(
tf_cc_test(
name = "conv_emitter_test",
srcs = ["conv_emitter_test.cc"],
tags = [
"no_oss", # TODO(b/148143101): Test should pass in OSS.
],
deps = [
":conv_emitter",
"//tensorflow/compiler/xla/service:hlo_parser",

View File

@ -340,11 +340,12 @@ StatusOr<InitialMlirConvAnchors> CreateNaiveMlirConv(
builder.getF32Type());
}();
auto accum_load_op =
builder.createOrFold<mlir::AffineLoadOp>(location, output_acc);
builder.createOrFold<mlir::AffineStoreOp>(
location,
builder.create<mlir::AddFOp>(
location,
builder.createOrFold<mlir::AffineLoadOp>(location, output_acc),
location, accum_load_op,
builder.create<mlir::MulFOp>(location, loaded_input, loaded_filter)),
output_acc, llvm::ArrayRef<mlir::Value>());