Skip to content

Commit a105da1

Browse files
committed
Be more tolerant of constant integral sizes
1 parent 57c9faf commit a105da1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clang/lib/CIR/CodeGen/CIRGenOpenACCClause.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ class OpenACCClauseCIREmitter final
354354
llvm::APInt value =
355355
clause.getIntExpr()->EvaluateKnownConstInt(cgf.cgm.getASTContext());
356356

357-
if (value.getBitWidth() != 64)
358-
value = value.sext(64);
359-
357+
value = value.sextOrTrunc(64);
360358
operation.setCollapseForDeviceTypes(builder.getContext(),
361359
lastDeviceTypeValues, value);
362360
} else {
@@ -381,8 +379,8 @@ class OpenACCClauseCIREmitter final
381379
} else {
382380
llvm::APInt curValue =
383381
e->EvaluateKnownConstInt(cgf.cgm.getASTContext());
384-
values.push_back(
385-
createConstantInt(exprLoc, 64, curValue.getSExtValue()));
382+
values.push_back(createConstantInt(
383+
exprLoc, 64, curValue.sextOrTrunc(64).getSExtValue()));
386384
}
387385
}
388386

0 commit comments

Comments
 (0)