This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Support vscale assumes for isKnownToBeAPowerOfTwo
ClosedPublic

Authored by Allen on Jul 14 2023, 7:11 PM.

Details

Summary

This patch is separated from D154953 to see what tests are affected by this
change alone according comment.

Depend on the related updating of LangRef on D155193.

Diff Detail

Event Timeline

Allen created this revision.Jul 14 2023, 7:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 7:11 PM
Allen requested review of this revision.Jul 14 2023, 7:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 7:11 PM

Please pre-commit the new tests.

llvm/test/Transforms/InstCombine/rem-mul-shl.ll
844

Don't use attribute group, inline the attribute.

882

nounwind and uwtable are irrelevant.

Allen updated this revision to Diff 540650.Jul 15 2023, 1:05 AM

inline the attribute according comment

Allen marked 2 inline comments as done.Jul 15 2023, 1:07 AM
Allen added inline comments.
llvm/test/Transforms/InstCombine/rem-mul-shl.ll
844

Apply your comment, thanks

nikic added a comment.Jul 15 2023, 1:28 AM

Please pre-commit the new tests.

Not done.

Allen updated this revision to Diff 540667.Jul 15 2023, 3:03 AM
Allen marked an inline comment as done.

rebase with precommit test

nikic accepted this revision.Jul 15 2023, 3:10 AM

LGTM

This revision is now accepted and ready to land.Jul 15 2023, 3:10 AM
This revision was landed with ongoing or failed builds.Jul 15 2023, 4:44 AM
This revision was automatically updated to reflect the committed changes.

This change has caused an llvm-test-suite failure to build on our SVE VLA (vector length agnostic) buildbot: https://lab.llvm.org/buildbot/#/builders/198/builds/3716

clang: ../llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1946: SDValue llvm::SelectionDAG::getVScale(const SDLoc &, EVT, APInt, bool): Assertion `MulImm.getSignificantBits() <= VT.getSizeInBits() && "Immediate does not fit VT"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1.install/bin/clang -DNDEBUG -mcpu=neoverse-512tvb -mllvm -scalable-vectorization=preferred -mllvm -treat-scalable-fixed-error-as-warning=false -O3 -w -DHAVE_CONFIG_H -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/test/test-suite/MultiSource/Applications/ClamAV -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/test/test-suite/MultiSource/Applications/ClamAV/zlib -DDONT_LOCK_DBDIRS -DC_LINUX -DFPU_WORDS_BIGENDIAN=0 -DWORDS_BIGENDIAN=0 -MD -MT MultiSource/Applications/ClamAV/CMakeFiles/clamscan.dir/libclamav_spin.c.o -MF CMakeFiles/clamscan.dir/libclamav_spin.c.o.d -o CMakeFiles/clamscan.dir/libclamav_spin.c.o -c /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/test/test-suite/MultiSource/Applications/ClamAV/libclamav_spin.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/test/test-suite/MultiSource/Applications/ClamAV/libclamav_spin.c'.
4. Running pass 'AArch64 Instruction Selection' on function '@unspin'

I will dig out a reproducer for you.

dmgreen added a subscriber: dmgreen.EditedJul 19 2023, 1:35 AM

There should be a fix (hopefully) in https://reviews.llvm.org/D155626.

(I wasn't sure it was caused by this, but the assert looks the same).

I don't think it should require SVE because it also shows up on our 1 stage bot: https://lab.llvm.org/buildbot/#/builders/197/builds/8213

I'll give it a go myself on a non-SVE machine.

There should be a fix (hopefully) in https://reviews.llvm.org/D155626.

It does fix it, thanks.

(and it does reproduce without an SVE machine, but that is academic now)

Allen added a comment.Jul 19 2023, 2:03 AM

Thanks @dmgreen for the quick fix