summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorYaron Keren <yaron.keren@gmail.com>2014-04-19 13:47:43 +0000
committerYaron Keren <yaron.keren@gmail.com>2014-04-19 13:47:43 +0000
commitd7ba46b287c29f8b188a6515f3911bb7817a455d (patch)
treeb65dba085b0487fb80ee68d4e971a6eaf701003c /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
parent421304d18c2dba1bd6fa976b205f5c15196720a0 (diff)
downloadbcm5719-llvm-d7ba46b287c29f8b188a6515f3911bb7817a455d.tar.gz
bcm5719-llvm-d7ba46b287c29f8b188a6515f3911bb7817a455d.zip
Patch by Vadim Chugunov
Win64 stack unwinder gets confused when execution flow "falls through" after a call to 'noreturn' function. This fixes the "missing epilogue" problem by emitting a trap instruction for IR 'unreachable' on x86_x64-pc-windows. A secondary use for it would be for anyone wanting to make double-sure that 'noreturn' functions, indeed, do not return. llvm-svn: 206684
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 09563fd368b..a5b72748e2f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1041,8 +1041,10 @@ FastISel::SelectOperator(const User *I, unsigned Opcode) {
}
case Instruction::Unreachable:
- // Nothing to emit.
- return true;
+ if (TM.Options.TrapUnreachable)
+ return FastEmit_(MVT::Other, MVT::Other, ISD::TRAP) != 0;
+ else
+ return true;
case Instruction::Alloca:
// FunctionLowering has the static-sized case covered.
OpenPOWER on IntegriCloud