forked from OSchip/llvm-project
[OPENMP]Fix PR45439: `omp for collapse(2) ordered(2)` generates invalid
IR. Fixed a crash because of the not quite correct casting of the value of iterations.
This commit is contained in:
parent
e9264b746b
commit
1c92448656
|
@ -11206,10 +11206,9 @@ void CGOpenMPRuntime::emitDoacrossInit(CodeGenFunction &CGF,
|
|||
// dims.upper = num_iterations;
|
||||
LValue UpperLVal = CGF.EmitLValueForField(
|
||||
DimsLVal, *std::next(RD->field_begin(), UpperFD));
|
||||
llvm::Value *NumIterVal =
|
||||
CGF.EmitScalarConversion(CGF.EmitScalarExpr(NumIterations[I]),
|
||||
D.getNumIterations()->getType(), Int64Ty,
|
||||
D.getNumIterations()->getExprLoc());
|
||||
llvm::Value *NumIterVal = CGF.EmitScalarConversion(
|
||||
CGF.EmitScalarExpr(NumIterations[I]), NumIterations[I]->getType(),
|
||||
Int64Ty, NumIterations[I]->getExprLoc());
|
||||
CGF.EmitStoreOfScalar(NumIterVal, UpperLVal);
|
||||
// dims.stride = 1;
|
||||
LValue StrideLVal = CGF.EmitLValueForField(
|
||||
|
|
|
@ -25,6 +25,12 @@ void bar() {
|
|||
for (i = 0; i < n; ++i)
|
||||
for (j = 0; j < n; ++j)
|
||||
a[i] = b[i] + 1;
|
||||
// CHECK: call void @__kmpc_doacross_init(
|
||||
// CHECK: call void @__kmpc_doacross_fini(
|
||||
#pragma omp for collapse(2) ordered(2)
|
||||
for (int i = 0; i < n; i++)
|
||||
for (int j = 0; j < n; j++)
|
||||
;
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @main()
|
||||
|
|
Loading…
Reference in New Issue