diff options
author | Thomas Lively <tlively@google.com> | 2019-01-14 22:03:43 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-01-14 22:03:43 +0000 |
commit | 2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6 (patch) | |
tree | bfbcf03b9d8b4ccf47fbf3d809786bca04c273bf /llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp | |
parent | f3857f33c33d19b447639a87e7f6a65d994aa417 (diff) | |
download | llvm-2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6.zip llvm-2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6.tar.gz llvm-2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6.tar.bz2 |
[WebAssembly][FastISel] Do not assume naive CmpInst lowering
Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=40172. See
test/CodeGen/WebAssembly/PR40172.ll for an explanation.
Reviewers: dschuff, aheejin
Subscribers: nikic, llvm-commits, sunfish, jgravelle-google, sbc100
Differential Revision: https://reviews.llvm.org/D56457
llvm-svn: 351127
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index 527908d..3856700 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -443,13 +443,11 @@ unsigned WebAssemblyFastISel::zeroExtendToI32(unsigned Reg, const Value *V, switch (From) { case MVT::i1: - // If the value is naturally an i1, we don't need to mask it. - // TODO: Recursively examine selects, phis, and, or, xor, constants. - if (From == MVT::i1 && V != nullptr) { - if (isa<CmpInst>(V) || - (isa<Argument>(V) && cast<Argument>(V)->hasZExtAttr())) - return copyValue(Reg); - } + // If the value is naturally an i1, we don't need to mask it. We only know + // if a value is naturally an i1 if it is definitely lowered by FastISel, + // not a DAG ISel fallback. + if (V != nullptr && isa<Argument>(V) && cast<Argument>(V)->hasZExtAttr()) + return copyValue(Reg); break; case MVT::i8: case MVT::i16: |