================
@@ -193,8 +334,23 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
switch (op) {
case UO_Deref: {
- cgm.errorNYI(e->getSourceRange(), "UnaryOp dereference");
- return LValue();
+ QualType t = e->getSubExpr()->getType()->getPointeeType();
+ assert(!t.isNull() && "CodeGenFunction::EmitUnaryOpLValue: Illegal type");
+
+ assert(!cir::MissingFeatures::lvalueBaseInfo());
+ assert(!cir::MissingFeatures::opTBAA());
+ Address addr = emitPointerWithAlignment(e->getSubExpr());
+
+ // Tag 'load' with deref attribute.
+ if (auto loadOp =
+ dyn_cast<cir::LoadOp>(addr.getPointer().getDefiningOp())) {
+ loadOp.setIsDerefAttr(mlir::UnitAttr::get(&getMLIRContext()));
----------------
efriedma-quic wrote:
If I'm following correctly, the "deref" attribute is supposed to indicate the
pointer is dereferenced... but the way it's implemented, this is a static
property of the code structure, not a dynamic property of the execution. There
might be some codepath where it doesn't actually get dereferenced... and in
fact, the dereference might not be reachable at all.
Given that, what can you actually do with "deref" information?
https://github.com/llvm/llvm-project/pull/134317
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits