File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -6949,16 +6949,13 @@ void CodeGenFunction::EmitOMPUseDeviceAddrClause(
69496949 // For declrefs and variable length array need to load the pointer for
69506950 // correct mapping, since the pointer to the data was passed to the runtime.
69516951 if (isa<DeclRefExpr>(Ref->IgnoreParenImpCasts ()) ||
6952- MatchingVD->getType ()->isArrayType ())
6953- PrivAddr =
6954- EmitLoadOfPointer (PrivAddr, getContext ()
6955- .getPointerType (OrigVD->getType ())
6956- ->castAs <PointerType>());
6957- llvm::Type *RealElTy =
6958- ConvertTypeForMem (OrigVD->getType ().getNonReferenceType ());
6959- llvm::Type *RealTy = RealElTy->getPointerTo ();
6960- PrivAddr =
6961- Builder.CreatePointerBitCastOrAddrSpaceCast (PrivAddr, RealTy, RealElTy);
6952+ MatchingVD->getType ()->isArrayType ()) {
6953+ QualType PtrTy = getContext ().getPointerType (
6954+ OrigVD->getType ().getNonReferenceType ());
6955+ PrivAddr = EmitLoadOfPointer (
6956+ Builder.CreateElementBitCast (PrivAddr, ConvertTypeForMem (PtrTy)),
6957+ PtrTy->castAs <PointerType>());
6958+ }
69626959
69636960 (void )PrivateScope.addPrivate (OrigVD, PrivAddr);
69646961 }
Original file line number Diff line number Diff line change @@ -90,8 +90,8 @@ int main() {
9090// CHECK: [[A_REF:%.+]] = load float*, float** [[BPTR0_A_ADDR]],
9191// CHECK: [[REF_REF:%.+]] = load float*, float** [[BPTR2_REF_ADDR]],
9292// CHECK: store float* [[REF_REF]], float** [[TMP_REF_ADDR:%.+]],
93- // CHECK: [[ARR :%.+]] = load float*, float** [[BPTR3_ARR_ADDR]],
94- // CHECK: [[ARR_REF:%.+]] = bitcast float* [[ARR]] to [ 4 x float]*
93+ // CHECK: [[BPTR3_ARR_ADDR_CAST :%.+]] = bitcast float** [[BPTR3_ARR_ADDR]] to [4 x float]**
94+ // CHECK: [[ARR_REF:%.+]] = load [4 x float]*, [ 4 x float]** [[BPTR3_ARR_ADDR_CAST]],
9595// CHECK: [[VLA_REF:%.+]] = load float*, float** [[BPTR4_VLA_ADDR]],
9696// CHECK: [[A:%.+]] = load float, float* [[A_REF]],
9797// CHECK: [[INC:%.+]] = fadd float [[A]], 1.000000e+00
You can’t perform that action at this time.
0 commit comments