Skip to content

Commit 5b0bef4

Browse files
authored
[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 657d213 commit 5b0bef4

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
@@ -1362,10 +1362,9 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *E) {
13621362
QualType T = ExprTy->castAs<clang::ComplexType>()->getElementType();
13631363

13641364
auto Loc = getLoc(E->getExprLoc());
1365-
Address Component =
1366-
(E->getOpcode() == UO_Real
1367-
? emitAddrOfRealComponent(Loc, LV.getAddress(), LV.getType())
1368-
: emitAddrOfImagComponent(Loc, LV.getAddress(), LV.getType()));
1365+
Address Component = E->getOpcode() == UO_Real
1366+
? builder.createRealPtr(Loc, LV.getAddress())
1367+
: builder.createImagPtr(Loc, LV.getAddress());
13691368
LValue ElemLV = makeAddrLValue(Component, T, LV.getBaseInfo(),
13701369
CGM.getTBAAInfoForSubobject(LV, T));
13711370
ElemLV.getQuals().addQualifiers(LV.getQuals());

0 commit comments

Comments
 (0)