Skip to content

Commit 928645a

Browse files
[SYCL] Avoid optimizing out integer conversion (#8409)
This commit fixes and issue where an integer conversion happening inside an assert would cause the conversion to not happen when assertions were disabled. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 570dc5e commit 928645a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,13 @@ void CompileTimePropertiesPass::parseAlignmentAndApply(
467467
uint32_t attr_val;
468468

469469
if (DecorStr == "sycl-alignment") {
470-
assert(DecorValue && !DecorValue->getAsInteger(0, attr_val) &&
471-
"sycl-alignment attribute is missing or not valid");
470+
assert(DecorValue && "sycl-alignment attribute is missing");
472471

472+
bool DecorValueIntConvFailed = DecorValue->getAsInteger(0, attr_val);
473+
474+
std::ignore = DecorValueIntConvFailed;
475+
assert(!DecorValueIntConvFailed &&
476+
"sycl-alignment attribute is not an integer");
473477
assert(llvm::isPowerOf2_64(attr_val) &&
474478
"sycl-alignment attribute is not a power of 2");
475479

0 commit comments

Comments
 (0)