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(
6949
6949
// For declrefs and variable length array need to load the pointer for
6950
6950
// correct mapping, since the pointer to the data was passed to the runtime.
6951
6951
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
+ }
6962
6959
6963
6960
(void )PrivateScope.addPrivate (OrigVD, PrivAddr);
6964
6961
}
Original file line number Diff line number Diff line change @@ -90,8 +90,8 @@ int main() {
90
90
// CHECK: [[A_REF:%.+]] = load float*, float** [[BPTR0_A_ADDR]],
91
91
// CHECK: [[REF_REF:%.+]] = load float*, float** [[BPTR2_REF_ADDR]],
92
92
// 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]],
95
95
// CHECK: [[VLA_REF:%.+]] = load float*, float** [[BPTR4_VLA_ADDR]],
96
96
// CHECK: [[A:%.+]] = load float, float* [[A_REF]],
97
97
// CHECK: [[INC:%.+]] = fadd float [[A]], 1.000000e+00
You can’t perform that action at this time.
0 commit comments