summaryrefslogtreecommitdiff
path: root/src/ortho/llvm
diff options
context:
space:
mode:
authorTristan Gingold2015-09-08 07:49:39 +0200
committerTristan Gingold2015-09-08 07:49:39 +0200
commit01451cf740c46f26c50676effc753b6774fe6739 (patch)
treeb0e7a9678ac52caf0a74ce13177341982a767e49 /src/ortho/llvm
parent736462a895abfb0014e1cc5df396c5fd22cc16fd (diff)
downloadghdl-01451cf740c46f26c50676effc753b6774fe6739.tar.gz
ghdl-01451cf740c46f26c50676effc753b6774fe6739.tar.bz2
ghdl-01451cf740c46f26c50676effc753b6774fe6739.zip
llvm: do not generate code for function call if unreachable.
Diffstat (limited to 'src/ortho/llvm')
-rw-r--r--src/ortho/llvm/ortho_llvm.adb14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ortho/llvm/ortho_llvm.adb b/src/ortho/llvm/ortho_llvm.adb
index db78bd6..ed11b5f 100644
--- a/src/ortho/llvm/ortho_llvm.adb
+++ b/src/ortho/llvm/ortho_llvm.adb
@@ -2492,11 +2492,15 @@ package body Ortho_LLVM is
Res : ValueRef;
Old_Vals : ValueRefArray_Acc;
begin
- Res := BuildCall (Builder, Assocs.Subprg.LLVM,
- Assocs.Vals.all, Assocs.Vals'Last, Empty_Cstring);
- Old_Vals := Assocs.Vals;
- Free (Old_Vals);
- Set_Insn_Dbg (Res);
+ if not Unreach then
+ Res := BuildCall (Builder, Assocs.Subprg.LLVM,
+ Assocs.Vals.all, Assocs.Vals'Last, Empty_Cstring);
+ Old_Vals := Assocs.Vals;
+ Free (Old_Vals);
+ Set_Insn_Dbg (Res);
+ else
+ Res := Null_ValueRef;
+ end if;
return O_Enode'(LLVM => Res, Etype => Assocs.Subprg.Dtype);
end New_Function_Call;