Skip to content

Commit 02ac763

Browse files
committed
- IRGen _assumeNonNegative to an llvm.assume intrinsic
1 parent c606370 commit 02ac763

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/IRGen/GenBuiltin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,9 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
626626
llvm::MDNode *range = llvm::MDNode::get(ctx, rangeElems);
627627
I->setMetadata(llvm::LLVMContext::MD_range, range);
628628
}
629+
} else {
630+
auto *cmp = IGF.Builder.CreateICmpSGE(v, llvm::ConstantInt::get(v->getType(), 0));
631+
IGF.Builder.CreateIntrinsicCall(llvm::Intrinsic::assume, cmp);
629632
}
630633
// Don't generate any code for the builtin.
631634
return out.add(v);

0 commit comments

Comments
 (0)