[SimplifyCFG] Stop inserting calls to llvm.trap for UB
SimplifyCFG had logic to insert calls to llvm.trap for two very particular IR patterns: stores and invokes of undef/null. While InstCombine canonicalizes certain undefined behavior IR patterns to stores of undef, phase ordering means that this cannot be relied upon in general. There are much better tools than llvm.trap: UBSan and ASan. N.B. I could be argued into reverting this change if a clear argument as to why it is important that we synthesize llvm.trap for stores, I'd be hard pressed to see why it'd be useful for invokes... llvm-svn: 273778
This commit is contained in:
@@ -1833,7 +1833,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
|
||||
// As such, we replace the cleanupret with unreachable.
|
||||
if (auto *CleanupRet = dyn_cast<CleanupReturnInst>(BB->getTerminator()))
|
||||
if (CleanupRet->unwindsToCaller() && EHPadForCallUnwindsLocally)
|
||||
changeToUnreachable(CleanupRet, /*UseLLVMTrap=*/false);
|
||||
changeToUnreachable(CleanupRet);
|
||||
|
||||
Instruction *I = BB->getFirstNonPHI();
|
||||
if (!I->isEHPad())
|
||||
|
||||
Reference in New Issue
Block a user