================
@@ -5571,11 +5571,52 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const 
BinaryOperator *E) {
       break;
     }
 
-    RValue RV = EmitAnyExpr(E->getRHS());
+    llvm::Value *Previous = nullptr;
----------------
Zonotora wrote:

I would also like to have it work similar to how EmitCompoundAssignmentLValue 
works, however it doesn't seem completely trivial to make this change? Maybe it 
is better suited in its own PR as well? But I can definitely convert:
```cpp
if (E->getLHS()->refersToBitField()) {
      // Get the RHS before scalar conversion.
  if (auto *ICE = GetOriginalRHSForBitfieldAssignment(E)) {
    SrcType = ICE->getSubExpr()->getType();
    Previous = EmitScalarExpr(ICE->getSubExpr());
    // Pass default ScalarConversionOpts to avoid emitting
    // integer sanitizer checks as E refers to bitfield.
    llvm::Value *RHS = EmitScalarConversion(
        Previous, SrcType, ICE->getType(), ICE->getExprLoc());
    RV = RValue::get(RHS);
  }
}
```
to something like:
```cpp
if (E->getLHS()->refersToBitField())
  Previous = EmitForOriginalRHSBitfieldAssignment(E, &RHS));
```
to at least de-duplicate some parts of it...

https://github.com/llvm/llvm-project/pull/75481
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to