We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f153ac commit 3a72cd2Copy full SHA for 3a72cd2
IGC/Compiler/CustomSafeOptPass.cpp
@@ -1369,6 +1369,9 @@ void CustomSafeOptPass::visitBinaryOperator(BinaryOperator& I)
1369
llvm::Instruction* nextInst = llvm::dyn_cast<llvm::Instruction>(*(I.user_begin()));
1370
if (nextInst && nextInst->getOpcode() == Instruction::Add)
1371
{
1372
+ // do not apply if any add instruction has NSW flag since we can't save it
1373
+ if ((isa<OverflowingBinaryOperator>(I) && I.hasNoSignedWrap()) || nextInst->hasNoSignedWrap())
1374
+ return;
1375
ConstantInt* secondSrc0imm = dyn_cast<ConstantInt>(nextInst->getOperand(0));
1376
ConstantInt* secondSrc1imm = dyn_cast<ConstantInt>(nextInst->getOperand(1));
1377
// found 2 add instructions to swap srcs
0 commit comments