aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2017-11-28 01:13:40 +0000
committerDan Gohman <dan433584@gmail.com>2017-11-28 01:13:40 +0000
commitcdd48b8a6b08a1feb6acbc407b5735ed7e7dfead (patch)
tree97d0addeb2e51638441aca7ff7b3d4045d31ea68 /llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
parent9e3381e8dc447c936834cf291162a52cace2a517 (diff)
downloadllvm-cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead.zip
llvm-cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead.tar.gz
llvm-cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead.tar.bz2
[WebAssembly] Fix trapping behavior in fptosi/fptoui.
This adds code to protect WebAssembly's `trunc_s` family of opcodes from values outside their domain. Even though such conversions have full undefined behavior in C/C++, LLVM IR's `fptosi` and `fptoui` do not, and only return undef. This also implements the proposed non-trapping float-to-int conversion feature and uses that instead when available. llvm-svn: 319128
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp b/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
index 6fae72c..9e122a5 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
@@ -41,7 +41,8 @@ WebAssemblySubtarget::WebAssemblySubtarget(const Triple &TT,
const std::string &FS,
const TargetMachine &TM)
: WebAssemblyGenSubtargetInfo(TT, CPU, FS), HasSIMD128(false),
- HasAtomics(false), CPUString(CPU), TargetTriple(TT), FrameLowering(),
+ HasAtomics(false), HasNontrappingFPToInt(false), CPUString(CPU),
+ TargetTriple(TT), FrameLowering(),
InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
TLInfo(TM, *this) {}