Make Constant::getSplatValue recognize scalable vector splats of the
form created by ConstantVector::getSplat. Add unit test to verify that
C == ConstantVector::getSplat(C)->getSplatValue() for fixed width and
scalable vector splats
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
It looks like this affects a bunch of the pattern-matchers in PatternMatch.h; for example, m_APInt. Is that right?
llvm/lib/IR/Constants.cpp | ||
---|---|---|
1601 | I don't see any reason the index here would be a ConstantInt, in general. (I mean, the result here would be pretty silly if it wasn't, but nothing is actually enforcing it.) |
This comment was removed by ctetreau.
Comment Actions
This patch broke ninja check-all on the Solaris buildbots, e.g. clang-solaris11-sparcv9:
[530/724] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantsTest.cpp.o FAILED: unittests/IR/CMakeFiles/IRTests.dir/ConstantsTest.cpp.o /opt/llvm-buildbot/bin/c++ -DGTEST_HAS_RTTI=0 -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/IR -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR -Iinclude -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/Solaris -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/utils/unittest/googletest/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -Wno-variadic-macros -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT unittests/IR/CMakeFiles/IRTests.dir/ConstantsTest.cpp.o -MF unittests/IR/CMakeFiles/IRTests.dir/ConstantsTest.cpp.o.d -o unittests/IR/CMakeFiles/IRTests.dir/ConstantsTest.cpp.o -c /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp In file included from /usr/include/sys/select.h:27:0, from /usr/include/sys/types.h:665, from /usr/include/sys/wait.h:12, from /usr/include/stdlib.h:16, from /opt/llvm-buildbot/include/c++/7.4.0/cstdlib:75, from /opt/llvm-buildbot/include/c++/7.4.0/bits/stl_algo.h:59, from /opt/llvm-buildbot/include/c++/7.4.0/algorithm:62, from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/MathExtras.h:17, from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/ADT/APInt.h:19, from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/ADT/APFloat.h:19, from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/IR/Constants.h:23, from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp:9: /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp: In member function ‘virtual void llvm::{anonymous}::ConstantsTest_GetSplatValueRoundTrip_Test::TestBody()’: /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp:649:18: error: expected unqualified-id before numeric constant ElementCount SEC = {Min, true}; ^ /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp:652:29: error: unable to deduce ‘std::initializer_list<auto>&&’ from ‘{1, FEC}’ for (auto EC : {SEC, FEC}) { ^ /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/unittests/IR/ConstantsTest.cpp:652:29: note: deduced conf
<sys/time.h> has #define SEC 1
Please fix.
I don't see any reason the index here would be a ConstantInt, in general. (I mean, the result here would be pretty silly if it wasn't, but nothing is actually enforcing it.)