aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 33dd039..fbc0264 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1854,17 +1854,12 @@ bool FastISel::selectOperator(const User *I, unsigned Opcode) {
}
case Instruction::Unreachable: {
- if (TM.Options.TrapUnreachable) {
- if (TM.Options.NoTrapAfterNoreturn) {
- const auto *Call =
- dyn_cast_or_null<CallInst>(cast<Instruction>(I)->getPrevNode());
- if (Call && Call->doesNotReturn())
- return true;
- }
+ auto UI = cast<UnreachableInst>(I);
+ if (!UI->shouldLowerToTrap(TM.Options.TrapUnreachable,
+ TM.Options.NoTrapAfterNoreturn))
+ return true;
- return fastEmit_(MVT::Other, MVT::Other, ISD::TRAP) != 0;
- }
- return true;
+ return fastEmit_(MVT::Other, MVT::Other, ISD::TRAP) != 0;
}
case Instruction::Alloca: