[PATCH] D136014: [AArch64] Improve codegen for shifted mask op

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 09:35:01 PDT 2022


nathanchance added a comment.

Actually, I lied, here is an LLVM IR reproducer that has been passed through `llvm-reduce` based on whether `llc` crashed or not.

  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-unknown-linux-gnu"
  
  define void @drbd_req_state(ptr %drbd_req_state_ns) {
  entry:
    %bf.load = load i8, ptr null, align 4
    %0 = and i8 %bf.load, 0
    %bf.lshr = lshr i8 %bf.load, 1
    %1 = and i8 %bf.lshr, 1
    %bf.value7 = zext i8 %1 to i32
    %bf.shl8 = shl nuw i32 %bf.value7, 1
    %2 = load i32, ptr null, align 4
    %and = and i32 %bf.shl8, %2
    store i32 %bf.shl8, ptr %drbd_req_state_ns, align 4
    %coerce.val.ii = zext i32 %and to i64
    ret void
  }



  $ ../install/llvm/good/bin/llc reduced.ll
  
  $ ../install/llvm/bad/bin/llc reduced.ll
  llc: /home/nathan/cbl/src/llvm-project/llvm/include/llvm/ADT/APInt.h:1027: 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://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
  Stack dump:
  0.      Program arguments: ../install/llvm/bad/bin/llc reduced.ll
  1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
  2.      Running pass 'AArch64 Instruction Selection' on function '@drbd_req_state'
   #0 0x000055a2e0706641 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../install/llvm/bad/bin/llc+0x35d4641)
   #1 0x000055a2e07044fe llvm::sys::RunSignalHandlers() (../install/llvm/bad/bin/llc+0x35d24fe)
   #2 0x000055a2e0706ba6 SignalHandler(int) Signals.cpp:0:0
   #3 0x00007f077b3f4a00 (/usr/lib/libc.so.6+0x38a00)
   #4 0x00007f077b44464c (/usr/lib/libc.so.6+0x8864c)
   #5 0x00007f077b3f4958 raise (/usr/lib/libc.so.6+0x38958)
   #6 0x00007f077b3de53d abort (/usr/lib/libc.so.6+0x2253d)
   #7 0x00007f077b3de45c (/usr/lib/libc.so.6+0x2245c)
   #8 0x00007f077b3ed486 (/usr/lib/libc.so.6+0x31486)
   #9 0x000055a2ded20b3e (../install/llvm/bad/bin/llc+0x1beeb3e)
  #10 0x000055a2e03c71ba (anonymous namespace)::DAGCombiner::visitShiftByConstant(llvm::SDNode*) DAGCombiner.cpp:0:0
  #11 0x000055a2e03723d0 (anonymous namespace)::DAGCombiner::visitSHL(llvm::SDNode*) DAGCombiner.cpp:0:0
  #12 0x000055a2e035e8a8 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
  #13 0x000055a2e0359cb4 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) (../install/llvm/bad/bin/llc+0x3227cb4)
  #14 0x000055a2e051ca22 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (../install/llvm/bad/bin/llc+0x33eaa22)
  #15 0x000055a2e051b652 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (../install/llvm/bad/bin/llc+0x33e9652)
  #16 0x000055a2e0517c85 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (../install/llvm/bad/bin/llc+0x33e5c85)
  #17 0x000055a2df920ccb llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (../install/llvm/bad/bin/llc+0x27eeccb)
  #18 0x000055a2dfe1ae45 llvm::FPPassManager::runOnFunction(llvm::Function&) (../install/llvm/bad/bin/llc+0x2ce8e45)
  #19 0x000055a2dfe231a1 llvm::FPPassManager::runOnModule(llvm::Module&) (../install/llvm/bad/bin/llc+0x2cf11a1)
  #20 0x000055a2dfe1b848 llvm::legacy::PassManagerImpl::run(llvm::Module&) (../install/llvm/bad/bin/llc+0x2ce9848)
  #21 0x000055a2dec1fa84 main (../install/llvm/bad/bin/llc+0x1aeda84)
  #22 0x00007f077b3df290 (/usr/lib/libc.so.6+0x23290)
  #23 0x00007f077b3df34a __libc_start_main (/usr/lib/libc.so.6+0x2334a)
  #24 0x000055a2dec1a675 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
  fish: Job 1, '../install/llvm/bad/bin/llc red…' terminated by signal SIGABRT (Abort)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136014/new/

https://reviews.llvm.org/D136014



More information about the llvm-commits mailing list