From bdba3cd97da3b040d265d5a8edb0a09136dbd056 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 27 Jan 2012 13:37:18 -0800 Subject: [PATCH] Bugfix: add per-lane offsets when accessing varying data through a pointer! --- expr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/expr.cpp b/expr.cpp index b04c8319..725a1edc 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3065,8 +3065,10 @@ IndexExpr::GetLValue(FunctionEmitContext *ctx) const { if (baseValue == NULL || indexValue == NULL) return NULL; ctx->SetDebugPos(pos); - return ctx->GetElementPtrInst(baseValue, indexValue, - baseExprType, "ptr_offset"); + llvm::Value *ptr = ctx->GetElementPtrInst(baseValue, indexValue, + baseExprType, "ptr_offset"); + ptr = lAddVaryingOffsetsIfNeeded(ctx, ptr, GetLValueType()); + return ptr; } // Otherwise it's an array or vector