diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-03-22 19:04:08 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-03-22 19:04:08 +0100 |
commit | d43f982a3168b554fd0745c23c59f94503c0a211 (patch) | |
tree | 9f9eb1b90c4c00ebf3f83131d5212307a543b2eb /src/ortho/llvm | |
parent | 417195eef5d019d3ca4f26ab7f04063a8a6fdfce (diff) | |
download | ghdl-d43f982a3168b554fd0745c23c59f94503c0a211.tar.gz ghdl-d43f982a3168b554fd0745c23c59f94503c0a211.tar.bz2 ghdl-d43f982a3168b554fd0745c23c59f94503c0a211.zip |
ortho_llvm: handle more unreach cases.
Diffstat (limited to 'src/ortho/llvm')
-rw-r--r-- | src/ortho/llvm/ortho_llvm.adb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ortho/llvm/ortho_llvm.adb b/src/ortho/llvm/ortho_llvm.adb index a1c85dbe1..097569819 100644 --- a/src/ortho/llvm/ortho_llvm.adb +++ b/src/ortho/llvm/ortho_llvm.adb @@ -1280,6 +1280,10 @@ package body Ortho_LLVM is is Res : ValueRef; begin + if Unreach then + return O_Enode'(LLVM => Null_ValueRef, Etype => Operand.Etype); + end if; + case Operand.Etype.Kind is when ON_Integer_Types => case Kind is @@ -1355,6 +1359,10 @@ package body Ortho_LLVM is is Res : ValueRef; begin + if Unreach then + return O_Enode'(LLVM => Null_ValueRef, Etype => Ntype); + end if; + case Left.Etype.Kind is when ON_Unsigned_Type | ON_Boolean_Type @@ -2515,7 +2523,11 @@ package body Ortho_LLVM is Res : ValueRef; Bb_Then : BasicBlockRef; begin - -- FIXME: check Unreach + if Unreach then + Block := (Bb => Null_BasicBlockRef); + return; + end if; + Bb_Then := AppendBasicBlock (Cur_Func, Empty_Cstring); Block := (Bb => AppendBasicBlock (Cur_Func, Empty_Cstring)); Res := BuildCondBr (Builder, Cond.LLVM, Bb_Then, Block.Bb); @@ -2537,6 +2549,11 @@ package body Ortho_LLVM is Bb_Next := AppendBasicBlock (Cur_Func, Empty_Cstring); Res := BuildBr (Builder, Bb_Next); else + if Block.Bb = Null_BasicBlockRef then + -- The IF statement was unreachable. Else part is also + -- unreachable. + return; + end if; Bb_Next := Null_BasicBlockRef; end if; |