@@ -108,17 +108,14 @@ static Value *getBoundsCheckCond(Value *Ptr, Value *InstVal,
108108 return Or;
109109}
110110
111- static CallInst *InsertTrap (BuilderTy &IRB, bool DebugTrapBB,
112- std::optional<int8_t > GuardKind) {
111+ static CallInst *InsertTrap (BuilderTy &IRB, bool DebugTrapBB) {
113112 if (!DebugTrapBB)
114113 return IRB.CreateIntrinsic (Intrinsic::trap, {}, {});
115-
114+ // FIXME: Ideally we would use the SanitizerHandler::OutOfBounds constant.
116115 return IRB.CreateIntrinsic (
117116 Intrinsic::ubsantrap, {},
118117 ConstantInt::get (IRB.getInt8Ty (),
119- GuardKind.has_value ()
120- ? GuardKind.value ()
121- : IRB.GetInsertBlock ()->getParent ()->size ()));
118+ IRB.GetInsertBlock ()->getParent ()->size ()));
122119}
123120
124121static CallInst *InsertCall (BuilderTy &IRB, bool MayReturn, StringRef Name) {
@@ -253,7 +250,7 @@ static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI,
253250
254251 bool DebugTrapBB = !Opts.Merge ;
255252 CallInst *TrapCall = Opts.Rt ? InsertCall (IRB, Opts.Rt ->MayReturn , Name)
256- : InsertTrap (IRB, DebugTrapBB, Opts. GuardKind );
253+ : InsertTrap (IRB, DebugTrapBB);
257254 if (DebugTrapBB)
258255 TrapCall->addFnAttr (llvm::Attribute::NoMerge);
259256
0 commit comments