================
@@ -4184,29 +4184,14 @@ Value 
*ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
 }
 
 /// Emit pointer + index arithmetic.
-static Value *emitPointerArithmetic(CodeGenFunction &CGF,
-                                    const BinOpInfo &op,
-                                    bool isSubtraction) {
-  // Must have binary (not unary) expr here.  Unary pointer
-  // increment/decrement doesn't use this path.
-  const BinaryOperator *expr = cast<BinaryOperator>(op.E);
-
-  Value *pointer = op.LHS;
-  Expr *pointerOperand = expr->getLHS();
-  Value *index = op.RHS;
-  Expr *indexOperand = expr->getRHS();
-
-  // In a subtraction, the LHS is always the pointer.
-  if (!isSubtraction && !pointer->getType()->isPointerTy()) {
-    std::swap(pointer, index);
-    std::swap(pointerOperand, indexOperand);
-  }
-
+llvm::Value *CodeGenFunction::EmitPointerArithmetic(
----------------
efriedma-quic wrote:

This refactor is sort of tricky to follow; can you land it separately as an NFC 
patch?

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

Reply via email to