summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-25 08:04:19 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-25 08:04:19 +0000
commitd346a377375a4780c95f4d30150bdeaed1a35b65 (patch)
tree3d072a06308fde37e739c18b40e6da6d57996e42 /llvm/lib/CodeGen
parentbb53d23ef8127b0be819b730e5094bd1d4b8e515 (diff)
downloadbcm5719-llvm-d346a377375a4780c95f4d30150bdeaed1a35b65.tar.gz
bcm5719-llvm-d346a377375a4780c95f4d30150bdeaed1a35b65.zip
[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
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index 041fb7b912b..a8e089a23d2 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -963,9 +963,9 @@ void WinEHPrepare::removeImplausibleInstructions(Function &F) {
BasicBlock::iterator CallI =
std::prev(BB->getTerminator()->getIterator());
auto *CI = cast<CallInst>(&*CallI);
- changeToUnreachable(CI, /*UseLLVMTrap=*/false);
+ changeToUnreachable(CI);
} else {
- changeToUnreachable(&I, /*UseLLVMTrap=*/false);
+ changeToUnreachable(&I);
}
// There are no more instructions in the block (except for unreachable),
@@ -986,7 +986,7 @@ void WinEHPrepare::removeImplausibleInstructions(Function &F) {
IsUnreachableCleanupret = CRI->getCleanupPad() != CleanupPad;
if (IsUnreachableRet || IsUnreachableCatchret ||
IsUnreachableCleanupret) {
- changeToUnreachable(TI, /*UseLLVMTrap=*/false);
+ changeToUnreachable(TI);
} else if (isa<InvokeInst>(TI)) {
if (Personality == EHPersonality::MSVC_CXX && CleanupPad) {
// Invokes within a cleanuppad for the MSVC++ personality never
OpenPOWER on IntegriCloud