Skip to content

Commit 7907996

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][NFC] Restructure CIRGenExprComplex to be similar to upstream (#1965)
The goal of this PR is to prepare the code for backporting the new implementations of Arith operations for ComplexType and other expressions support - Reorder the functions in CIRGenExprComplex similar to upstream and classical codegen. - Remove unnecessary functions `emitAddrOfRealComponent` and `emitAddrOfImagComponent`. - The updated code style is to be similar to upstream.
1 parent 870cad5 commit 7907996

File tree

3 files changed

+643
-638
lines changed

3 files changed

+643
-638
lines changed

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,10 +1381,9 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *E) {
13811381
QualType T = ExprTy->castAs<clang::ComplexType>()->getElementType();
13821382

13831383
auto Loc = getLoc(E->getExprLoc());
1384-
Address Component =
1385-
(E->getOpcode() == UO_Real
1386-
? emitAddrOfRealComponent(Loc, LV.getAddress(), LV.getType())
1387-
: emitAddrOfImagComponent(Loc, LV.getAddress(), LV.getType()));
1384+
Address Component = E->getOpcode() == UO_Real
1385+
? builder.createRealPtr(Loc, LV.getAddress())
1386+
: builder.createImagPtr(Loc, LV.getAddress());
13881387
LValue ElemLV = makeAddrLValue(Component, T, LV.getBaseInfo(),
13891388
CGM.getTBAAInfoForSubobject(LV, T));
13901389
ElemLV.getQuals().addQualifiers(LV.getQuals());

0 commit comments

Comments
 (0)