Delete llvm.{sig,}{setjmp,longjmp} remnant after r136821

Intrinsic has incorrect argument type!
  i32 (i32*)* @llvm.setjmp

*wipes tear*
This commit is contained in:
Fangrui Song 2019-12-26 23:32:53 -08:00
parent ecbaf152f8
commit 7a7334663c
8 changed files with 1 additions and 104 deletions

View File

@ -1539,16 +1539,6 @@ public:
/// have to be legal as the hook is used before type legalization. /// have to be legal as the hook is used before type legalization.
virtual bool isSafeMemOpType(MVT /*VT*/) const { return true; } virtual bool isSafeMemOpType(MVT /*VT*/) const { return true; }
/// Determine if we should use _setjmp or setjmp to implement llvm.setjmp.
bool usesUnderscoreSetJmp() const {
return UseUnderscoreSetJmp;
}
/// Determine if we should use _longjmp or longjmp to implement llvm.longjmp.
bool usesUnderscoreLongJmp() const {
return UseUnderscoreLongJmp;
}
/// Return lower limit for number of blocks in a jump table. /// Return lower limit for number of blocks in a jump table.
virtual unsigned getMinimumJumpTableEntries() const; virtual unsigned getMinimumJumpTableEntries() const;
@ -1949,18 +1939,6 @@ protected:
SchedPreferenceInfo = Pref; SchedPreferenceInfo = Pref;
} }
/// Indicate whether this target prefers to use _setjmp to implement
/// llvm.setjmp or the version without _. Defaults to false.
void setUseUnderscoreSetJmp(bool Val) {
UseUnderscoreSetJmp = Val;
}
/// Indicate whether this target prefers to use _longjmp to implement
/// llvm.longjmp or the version without _. Defaults to false.
void setUseUnderscoreLongJmp(bool Val) {
UseUnderscoreLongJmp = Val;
}
/// Indicate the minimum number of blocks to generate jump tables. /// Indicate the minimum number of blocks to generate jump tables.
void setMinimumJumpTableEntries(unsigned Val); void setMinimumJumpTableEntries(unsigned Val);
@ -2697,16 +2675,6 @@ private:
/// predication. /// predication.
bool JumpIsExpensive; bool JumpIsExpensive;
/// This target prefers to use _setjmp to implement llvm.setjmp.
///
/// Defaults to false.
bool UseUnderscoreSetJmp;
/// This target prefers to use _longjmp to implement llvm.longjmp.
///
/// Defaults to false.
bool UseUnderscoreLongJmp;
/// Information about the contents of the high-bits in boolean values held in /// Information about the contents of the high-bits in boolean values held in
/// a type wider than i1. See getBooleanContents. /// a type wider than i1. See getBooleanContents.
BooleanContent BooleanContents; BooleanContent BooleanContents;

View File

@ -254,34 +254,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
break; break;
} }
// The setjmp/longjmp intrinsics should only exist in the code if it was
// never optimized (ie, right out of the CFE), or if it has been hacked on
// by the lowerinvoke pass. In both cases, the right thing to do is to
// convert the call to an explicit setjmp or longjmp call.
case Intrinsic::setjmp: {
Value *V = ReplaceCallWith("setjmp", CI, CS.arg_begin(), CS.arg_end(),
Type::getInt32Ty(Context));
if (!CI->getType()->isVoidTy())
CI->replaceAllUsesWith(V);
break;
}
case Intrinsic::sigsetjmp:
if (!CI->getType()->isVoidTy())
CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
break;
case Intrinsic::longjmp: {
ReplaceCallWith("longjmp", CI, CS.arg_begin(), CS.arg_end(),
Type::getVoidTy(Context));
break;
}
case Intrinsic::siglongjmp: {
// Insert the call to abort
ReplaceCallWith("abort", CI, CS.arg_end(), CS.arg_end(),
Type::getVoidTy(Context));
break;
}
case Intrinsic::ctpop: case Intrinsic::ctpop:
CI->replaceAllUsesWith(LowerCTPOP(Context, CI->getArgOperand(0), CI)); CI->replaceAllUsesWith(LowerCTPOP(Context, CI->getArgOperand(0), CI));
break; break;

View File

@ -5774,12 +5774,6 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
RegName, getValue(RegValue))); RegName, getValue(RegValue)));
return; return;
} }
case Intrinsic::setjmp:
lowerCallToExternalSymbol(I, &"_setjmp"[!TLI.usesUnderscoreSetJmp()]);
return;
case Intrinsic::longjmp:
lowerCallToExternalSymbol(I, &"_longjmp"[!TLI.usesUnderscoreLongJmp()]);
return;
case Intrinsic::memcpy: { case Intrinsic::memcpy: {
const auto &MCI = cast<MemCpyInst>(I); const auto &MCI = cast<MemCpyInst>(I);
SDValue Op1 = getValue(I.getArgOperand(0)); SDValue Op1 = getValue(I.getArgOperand(0));

View File

@ -580,8 +580,6 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm) : TM(tm) {
MaxGluedStoresPerMemcpy = 0; MaxGluedStoresPerMemcpy = 0;
MaxStoresPerMemsetOptSize = MaxStoresPerMemcpyOptSize = MaxStoresPerMemsetOptSize = MaxStoresPerMemcpyOptSize =
MaxStoresPerMemmoveOptSize = MaxLoadsPerMemcmpOptSize = 4; MaxStoresPerMemmoveOptSize = MaxLoadsPerMemcmpOptSize = 4;
UseUnderscoreSetJmp = false;
UseUnderscoreLongJmp = false;
HasMultipleConditionRegisters = false; HasMultipleConditionRegisters = false;
HasExtractBitsInsn = false; HasExtractBitsInsn = false;
JumpIsExpensive = JumpIsExpensiveOverride; JumpIsExpensive = JumpIsExpensiveOverride;

View File

@ -137,10 +137,6 @@ extern cl::opt<bool> ANDIGlueBug;
PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM, PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
const PPCSubtarget &STI) const PPCSubtarget &STI)
: TargetLowering(TM), Subtarget(STI) { : TargetLowering(TM), Subtarget(STI) {
// Use _setjmp/_longjmp instead of setjmp/longjmp.
setUseUnderscoreSetJmp(true);
setUseUnderscoreLongJmp(true);
// On PPC32/64, arguments smaller than 4/8 bytes are extended, so all // On PPC32/64, arguments smaller than 4/8 bytes are extended, so all
// arguments are at least 4/8 bytes aligned. // arguments are at least 4/8 bytes aligned.
bool isPPC64 = Subtarget.isPPC64(); bool isPPC64 = Subtarget.isPPC64();

View File

@ -283,24 +283,6 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB,
case Intrinsic::loop_decrement: case Intrinsic::loop_decrement:
return true; return true;
// VisualStudio defines setjmp as _setjmp
#if defined(_MSC_VER) && defined(setjmp) && \
!defined(setjmp_undefined_for_msvc)
# pragma push_macro("setjmp")
# undef setjmp
# define setjmp_undefined_for_msvc
#endif
case Intrinsic::setjmp:
#if defined(_MSC_VER) && defined(setjmp_undefined_for_msvc)
// let's return it to _setjmp state
# pragma pop_macro("setjmp")
# undef setjmp_undefined_for_msvc
#endif
case Intrinsic::longjmp:
// Exclude eh_sjlj_setjmp; we don't need to exclude eh_sjlj_longjmp // Exclude eh_sjlj_setjmp; we don't need to exclude eh_sjlj_longjmp
// because, although it does clobber the counter register, the // because, although it does clobber the counter register, the
// control can't then return to inside the loop unless there is also // control can't then return to inside the loop unless there is also

View File

@ -162,19 +162,6 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setLibcallName(RTLIB::POWI_F64, nullptr); setLibcallName(RTLIB::POWI_F64, nullptr);
} }
if (Subtarget.isTargetDarwin()) {
// Darwin should use _setjmp/_longjmp instead of setjmp/longjmp.
setUseUnderscoreSetJmp(false);
setUseUnderscoreLongJmp(false);
} else if (Subtarget.isTargetWindowsGNU()) {
// MS runtime is weird: it exports _setjmp, but longjmp!
setUseUnderscoreSetJmp(true);
setUseUnderscoreLongJmp(false);
} else {
setUseUnderscoreSetJmp(true);
setUseUnderscoreLongJmp(true);
}
// If we don't have cmpxchg8b(meaing this is a 386/486), limit atomic size to // If we don't have cmpxchg8b(meaing this is a 386/486), limit atomic size to
// 32 bits so the AtomicExpandPass will expand it so we don't need cmpxchg8b. // 32 bits so the AtomicExpandPass will expand it so we don't need cmpxchg8b.
// FIXME: Should we be limitting the atomic size on other configs? Default is // FIXME: Should we be limitting the atomic size on other configs? Default is

View File

@ -3951,7 +3951,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
return eraseInstFromFunction(CI); return eraseInstFromFunction(CI);
// Bail if we cross over an intrinsic with side effects, such as // Bail if we cross over an intrinsic with side effects, such as
// llvm.stacksave, llvm.read_register, or llvm.setjmp. // llvm.stacksave, or llvm.read_register.
if (II2->mayHaveSideEffects()) { if (II2->mayHaveSideEffects()) {
CannotRemove = true; CannotRemove = true;
break; break;