From fd569004b78124c1041feee75a1e311166268c8d Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 4 Dec 2010 12:43:24 +0000 Subject: Silly special case: never load when dereferencing void*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120905 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 8ed8cb38db..a65eae8f78 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -312,7 +312,11 @@ public: // value as the "address". return EmitLValue(E->getSubExpr()).getAddress(); } - Value *VisitUnaryDeref(const Expr *E) { return EmitLoadOfLValue(E); } + Value *VisitUnaryDeref(const UnaryOperator *E) { + if (E->getType()->isVoidType()) + return Visit(E->getSubExpr()); // the actual value should be unused + return EmitLoadOfLValue(E); + } Value *VisitUnaryPlus(const UnaryOperator *E) { // This differs from gcc, though, most likely due to a bug in gcc. TestAndClearIgnoreResultAssign(); -- cgit v1.2.3