Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed #1183

Closed
nickdesaulniers opened this issue Oct 20, 2020 · 6 comments
Labels
[ARCH] s390 This bug impacts ARCH=s390 [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0

Comments

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Oct 20, 2020

while confirming #1181 on mainline, I hit a new assertion failure:

$ ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- make CC=clang -j71 fs/cifs/smb2ops.o
...
clang-12: ../include/llvm/ADT/APInt.h:1151: bool llvm::APInt::operator==(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /android0/llvm-project/llvm/build/bin/clang-12 -cc1 -triple s390x-unknown-linux-gnu -S -disable-free -main-file-name smb2ops.c -mrelocation-model pic -pic-level 2 -fno-delete-null-pointer-checks -mllvm -warn-stack-size=1024 -mframe-pointer=none -relaxed-aliasing -fmath-errno -fno-rounding-math -no-integrated-as -mconstructor-aliases -target-cpu z196 -target-feature +soft-float -mbackchain -mpacked-stack -msoft-float -mfloat-abi soft -fno-split-dwarf-inlining -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -nostdsysteminc -nobuiltininc -resource-dir /android0/llvm-project/llvm/build/lib/clang/12.0.0 -dependency-file fs/cifs/.smb2ops.o.d -MT fs/cifs/smb2ops.o -isystem /android0/llvm-project/llvm/build/lib/clang/12.0.0/include -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -I ./arch/s390/include -I ./arch/s390/include/generated -I ./include -I ./arch/s390/include/uapi -I ./arch/s390/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -D __KERNEL__ -D __PACK_STACK -D CONFIG_AS_CFI_VAL_OFFSET=1 -D CC_USING_NOP_MCOUNT -D CC_USING_FENTRY -I fs/cifs -D MODULE -D KBUILD_BASENAME="smb2ops" -D KBUILD_MODNAME="cifs" -fmacro-prefix-map=./= -O2 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -Werror=unknown-warning-option -Wno-sign-compare -Wno-frame-address -Wno-address-of-packed-member -Wno-format-invalid-specifier -Wno-gnu -Wno-unused-const-variable -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -std=gnu89 -fno-dwarf-directory-asm -fdebug-compilation-dir /android0/kernel-all -ferror-limit 19 -pg -mfentry -mnop-mcount -mrecord-mcount -fwrapv -fno-signed-char -fwchar-type=short -fno-signed-wchar -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/smb2ops-7c0051.s -x c fs/cifs/smb2ops.c 

1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'fs/cifs/smb2ops.c'.
4.      Running pass 'Combine redundant instructions' on function '@smb2_query_symlink'

 #0 0x0000000003f65713 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/android0/llvm-project/llvm/build/bin/clang-12+0x3f65713)
 #1 0x0000000003f6346e llvm::sys::RunSignalHandlers() (/android0/llvm-project/llvm/build/bin/clang-12+0x3f6346e)
 #2 0x0000000003f65bd5 SignalHandler(int) (/android0/llvm-project/llvm/build/bin/clang-12+0x3f65bd5)
 #3 0x00007fc85d091140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007fc85cb69db1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fc85cb53537 abort ./stdlib/abort.c:81:7
 #6 0x00007fc85cb5340f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #7 0x00007fc85cb5340f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #8 0x00007fc85cb625b2 (/lib/x86_64-linux-gnu/libc.so.6+0x345b2)
 #9 0x0000000003abcdad llvm::InstCombinerImpl::foldOrOfICmps(llvm::ICmpInst*, llvm::ICmpInst*, llvm::BinaryOperator&) (/android0/llvm-project/llvm/build/bin/clang-12+0x3abcdad)
#10 0x0000000003ac3205 llvm::InstCombinerImpl::visitOr(llvm::BinaryOperator&) (/android0/llvm-project/llvm/build/bin/clang-12+0x3ac3205)
#11 0x0000000003a9b09d llvm::InstCombinerImpl::run() (/android0/llvm-project/llvm/build/bin/clang-12+0x3a9b09d)
#12 0x0000000003a9d328 combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, unsigned int, llvm::LoopInfo*) (/android0/llvm-project/llvm/build/bin/clang-12+0x3a9d328)
#13 0x0000000003a9ec51 llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) (/android0/llvm-project/llvm/build/bin/clang-12+0x3a9ec51)
#14 0x000000000389ad18 llvm::FPPassManager::runOnFunction(llvm::Function&) (/android0/llvm-project/llvm/build/bin/clang-12+0x389ad18)
#15 0x000000000362da23 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) (/android0/llvm-project/llvm/build/bin/clang-12+0x362da23)
#16 0x000000000389b3c7 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/android0/llvm-project/llvm/build/bin/clang-12+0x389b3c7)
#17 0x000000000418c7ba clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/android0/llvm-project/llvm/build/bin/clang-12+0x418c7ba)
#18 0x00000000049cb1ec clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/android0/llvm-project/llvm/build/bin/clang-12+0x49cb1ec)
#19 0x00000000059f4bc3 clang::ParseAST(clang::Sema&, bool, bool) (/android0/llvm-project/llvm/build/bin/clang-12+0x59f4bc3)
#20 0x00000000049163e3 clang::FrontendAction::Execute() (/android0/llvm-project/llvm/build/bin/clang-12+0x49163e3)
#21 0x000000000486c8c2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/android0/llvm-project/llvm/build/bin/clang-12+0x486c8c2)
#22 0x00000000049c4ec2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/android0/llvm-project/llvm/build/bin/clang-12+0x49c4ec2)
#23 0x00000000027e58f3 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/android0/llvm-project/llvm/build/bin/clang-12+0x27e58f3)
#24 0x00000000027e39bc ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/android0/llvm-project/llvm/build/bin/clang-12+0x27e39bc)
#25 0x00000000027e3717 main (/android0/llvm-project/llvm/build/bin/clang-12+0x27e3717)
#26 0x00007fc85cb54cca __libc_start_main ./csu/../csu/libc-start.c:308:16
#27 0x00000000027e05ea _start (/android0/llvm-project/llvm/build/bin/clang-12+0x27e05ea)

let me see if I can bisect this quickly, and get a reproducer. cc @uweigand

@nickdesaulniers nickdesaulniers added [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [ARCH] s390 This bug impacts ARCH=s390 labels Oct 20, 2020
@nickdesaulniers
Copy link
Member Author

$ git bisect log
# bad: [b3ccfa1e0ce74041a76ce802e3be7944eea57c41] [hwasan] Increase max allocation size to 1Tb.
# good: [e0567582b8b1def8656f4a5addce0909fa51c86e] [NFCI][SCEV] Always refer to enum SCEVTypes as enum, not integer
git bisect start 'HEAD' 'e0567582b8b1'
# good: [3be2b0d1a1e0b94e8586f695e8174f139f7a84d8] [yaml2obj][NFCI] - Address post commit comments for "[yaml2obj][ELF] - Simplify the code that performs sections validation."
git bisect good 3be2b0d1a1e0b94e8586f695e8174f139f7a84d8
# bad: [234c47ae2a8e1877de8c661d5bb862ba952eabf9] [clang][Basic] Make SourceLocation usable as key in hash maps, NFCI
git bisect bad 234c47ae2a8e1877de8c661d5bb862ba952eabf9
# bad: [e372a5f86f6488bb0c2593a665d51fdd3a97c6e4] [InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support
git bisect bad e372a5f86f6488bb0c2593a665d51fdd3a97c6e4
# good: [e346ea990528d93758ed216c53b2ef86ea82ff72] [InstCombine] SimplifyDemandedUseBits - pass APInt by const reference. NFCI.
git bisect good e346ea990528d93758ed216c53b2ef86ea82ff72
# good: [29d1a494477d78f9c86564b851891702456ddffb] [flang] Document and use intrinsic subroutine argument intents
git bisect good 29d1a494477d78f9c86564b851891702456ddffb
# good: [229db3647491ed2b2706a9b9ce13a97e38be6fa0] [libc++] Make __shared_weak_count vtable consistent across all build configurations
git bisect good 229db3647491ed2b2706a9b9ce13a97e38be6fa0
# good: [db915f296f58cb28493356118e8f033c8daecc89] Revert "Revert "[gn build] (manually) port d09b08919ca""
git bisect good db915f296f58cb28493356118e8f033c8daecc89
# first bad commit: [e372a5f86f6488bb0c2593a665d51fdd3a97c6e4] [InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support
e372a5f86f6488bb0c2593a665d51fdd3a97c6e4 is the first bad commit
commit e372a5f86f6488bb0c2593a665d51fdd3a97c6e4
Author: Simon Pilgrim <llvm-dev@redking.me.uk>
Date:   Tue Oct 20 13:27:43 2020 +0100

    [InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support
    
    Reapplied rGa704d8238c86 with a check for integer/integervector types to prevent matching with pointer types

 .../Transforms/InstCombine/InstCombineAndOrXor.cpp | 53 +++++++++++-----------
 llvm/test/Transforms/InstCombine/or.ll             | 10 ++--

@nickdesaulniers
Copy link
Member Author

nickdesaulniers referenced this issue in llvm/llvm-project Oct 20, 2020
…C2), C3)) uniform vector support

Reapplied rGa704d8238c86 with a check for integer/integervector types to prevent matching with pointer types
@nickdesaulniers
Copy link
Member Author

test case:

// clang -O2 foo.c
int b;
long c;
int a(void);
void smb2_query_symlink(void) {
  if (a() < sizeof(int) || c < sizeof(int)) b;
}

@nickdesaulniers
Copy link
Member Author

it's not a clean revert for e372a5f, some other patches will also need to be backed out unless we can fix-forward quickly.

@nickdesaulniers
Copy link
Member Author

Looks like it should be reverted in 4de215ff187746ff02ffdc6bd56bb54d42cbfdca (TODO): confirm

@nickdesaulniers
Copy link
Member Author

1000th bug closed 🥳

@nickdesaulniers nickdesaulniers added the [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0 label Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] s390 This bug impacts ARCH=s390 [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0
Projects
None yet
Development

No branches or pull requests

1 participant