-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[CIR] Fix alignment when lowering set/get bitfield operations #148999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -424,23 +424,23 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { | |
| } | ||
|
|
||
| mlir::Value createSetBitfield(mlir::Location loc, mlir::Type resultType, | ||
| mlir::Value dstAddr, mlir::Type storageType, | ||
| Address dstAddr, mlir::Type storageType, | ||
| mlir::Value src, const CIRGenBitFieldInfo &info, | ||
| bool isLvalueVolatile, bool useVolatile, | ||
| unsigned alignment = 0) { | ||
| bool isLvalueVolatile, bool useVolatile) { | ||
| return create<cir::SetBitfieldOp>( | ||
| loc, resultType, dstAddr, storageType, src, info.name, info.size, | ||
| info.offset, info.isSigned, isLvalueVolatile, alignment); | ||
| loc, resultType, dstAddr.getPointer(), storageType, src, info.name, | ||
| info.size, info.offset, info.isSigned, isLvalueVolatile, | ||
| dstAddr.getAlignment().getAsAlign().value()); | ||
| } | ||
|
|
||
| mlir::Value createGetBitfield(mlir::Location loc, mlir::Type resultType, | ||
| mlir::Value addr, mlir::Type storageType, | ||
| Address addr, mlir::Type storageType, | ||
| const CIRGenBitFieldInfo &info, | ||
| bool isLvalueVolatile, bool useVolatile, | ||
| unsigned alignment = 0) { | ||
| bool isLvalueVolatile, bool useVolatile) { | ||
|
||
| return create<cir::GetBitfieldOp>( | ||
| loc, resultType, addr, storageType, info.name, info.size, info.offset, | ||
| info.isSigned, isLvalueVolatile, alignment); | ||
| loc, resultType, addr.getPointer(), storageType, info.name, info.size, | ||
| info.offset, info.isSigned, isLvalueVolatile, | ||
| addr.getAlignment().getAsAlign().value()); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,10 +337,9 @@ mlir::Value CIRGenFunction::emitStoreThroughBitfieldLValue(RValue src, | |
|
|
||
| mlir::Value dstAddr = dst.getAddress().getPointer(); | ||
|
|
||
| return builder.createSetBitfield( | ||
| dstAddr.getLoc(), resLTy, dstAddr, ptr.getElementType(), src.getValue(), | ||
| info, dst.isVolatileQualified(), useVolatile, | ||
| dst.getAddress().getAlignment().getAsAlign().value()); | ||
| return builder.createSetBitfield(dstAddr.getLoc(), resLTy, ptr, | ||
| ptr.getElementType(), src.getValue(), info, | ||
| dst.isVolatileQualified(), useVolatile); | ||
| } | ||
|
|
||
| RValue CIRGenFunction::emitLoadOfBitfieldLValue(LValue lv, SourceLocation loc) { | ||
|
|
@@ -352,9 +351,9 @@ RValue CIRGenFunction::emitLoadOfBitfieldLValue(LValue lv, SourceLocation loc) { | |
|
|
||
| assert(!cir::MissingFeatures::armComputeVolatileBitfields()); | ||
|
|
||
| mlir::Value field = builder.createGetBitfield( | ||
| getLoc(loc), resLTy, ptr.getPointer(), ptr.getElementType(), info, | ||
| lv.isVolatile(), false, ptr.getAlignment().getAsAlign().value()); | ||
| mlir::Value field = | ||
| builder.createGetBitfield(getLoc(loc), resLTy, ptr, ptr.getElementType(), | ||
| info, lv.isVolatile(), false); | ||
|
||
| assert(!cir::MissingFeatures::opLoadEmitScalarRangeCheck() && "NYI"); | ||
| return RValue::get(field); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useVolatileis never used can we remove it? We can always add it later.