@@ -108,17 +108,14 @@ static Value *getBoundsCheckCond(Value *Ptr, Value *InstVal,
108
108
return Or;
109
109
}
110
110
111
- static CallInst *InsertTrap (BuilderTy &IRB, bool DebugTrapBB,
112
- std::optional<int8_t > GuardKind) {
111
+ static CallInst *InsertTrap (BuilderTy &IRB, bool DebugTrapBB) {
113
112
if (!DebugTrapBB)
114
113
return IRB.CreateIntrinsic (Intrinsic::trap, {}, {});
115
-
114
+ // FIXME: Ideally we would use the SanitizerHandler::OutOfBounds constant.
116
115
return IRB.CreateIntrinsic (
117
116
Intrinsic::ubsantrap, {},
118
117
ConstantInt::get (IRB.getInt8Ty (),
119
- GuardKind.has_value ()
120
- ? GuardKind.value ()
121
- : IRB.GetInsertBlock ()->getParent ()->size ()));
118
+ IRB.GetInsertBlock ()->getParent ()->size ()));
122
119
}
123
120
124
121
static CallInst *InsertCall (BuilderTy &IRB, bool MayReturn, StringRef Name) {
@@ -253,7 +250,7 @@ static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI,
253
250
254
251
bool DebugTrapBB = !Opts.Merge ;
255
252
CallInst *TrapCall = Opts.Rt ? InsertCall (IRB, Opts.Rt ->MayReturn , Name)
256
- : InsertTrap (IRB, DebugTrapBB, Opts. GuardKind );
253
+ : InsertTrap (IRB, DebugTrapBB);
257
254
if (DebugTrapBB)
258
255
TrapCall->addFnAttr (llvm::Attribute::NoMerge);
259
256
0 commit comments