From d346a377375a4780c95f4d30150bdeaed1a35b65 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 25 Jun 2016 08:04:19 +0000 Subject: [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 --- llvm/lib/Transforms/Scalar/SCCP.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/SCCP.cpp') diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 91e625b7aac..264bdb6f353 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1802,8 +1802,7 @@ static bool runIPSCCP(Module &M, const DataLayout &DL, DEBUG(dbgs() << " BasicBlock Dead:" << *BB); ++NumDeadBlocks; - NumInstRemoved += - changeToUnreachable(BB->getFirstNonPHI(), /*UseLLVMTrap=*/false); + NumInstRemoved += changeToUnreachable(BB->getFirstNonPHI()); MadeChanges = true; -- cgit v1.2.3