[llvm] r353426 - [DAG] Cleanup unused node on failed SELECT Combine.

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 10:50:54 PST 2019


I suspect this patch is causing this:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10737

AIL: LLVM :: CodeGen/AArch64/bswap-known-bits.ll (5521 of 29747)
******************** TEST 'LLVM ::
CodeGen/AArch64/bswap-known-bits.ll' FAILED ********************
Script:
--
: 'RUN: at line 1';
/b/sanitizer-x86_64-linux-bootstrap/build/llvm_build_asan/bin/llc <
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/test/CodeGen/AArch64/bswap-known-bits.ll
-mtriple=aarch64-apple-darwin  |
/b/sanitizer-x86_64-linux-bootstrap/build/llvm_build_asan/bin/FileCheck
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/test/CodeGen/AArch64/bswap-known-bits.ll
--
Exit Code: 2

Command Output (stderr):
--
=================================================================
==25312==ERROR: AddressSanitizer: use-after-poison on address
0x62100004512a at pc 0x0000056e6d1e bp 0x7ffd018940d0 sp
0x7ffd018940c8
READ of size 2 at 0x62100004512a thread T0
    #0 0x56e6d1d in getValueType
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:975:5
    #1 0x56e6d1d in getValueType
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1123
    #2 0x56e6d1d in convertSelectOfFPConstantsToLoadOffset
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:18605
    #3 0x56e6d1d in (anonymous
namespace)::DAGCombiner::SimplifySelectCC(llvm::SDLoc const&,
llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::SDValue,
llvm::ISD::CondCode, bool)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:18681
    #4 0x565073d in (anonymous
namespace)::DAGCombiner::visitZERO_EXTEND(llvm::SDNode*)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9094:23
    #5 0x55dc7ef in (anonymous
namespace)::DAGCombiner::visit(llvm::SDNode*)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1541:40
    #6 0x55d12fc in (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1599:16
    #7 0x55cd397 in Run
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1439:18
    #8 0x55cd397 in llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults*, llvm::CodeGenOpt::Level)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:19508
    #9 0x5aa41be in llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:782:13
    #10 0x5a9dbfa in
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1812:7
    #11 0x5a92941 in
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:496:3
    #12 0x411288a in
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:13
    #13 0x4bb42e1 in
llvm::FPPassManager::runOnFunction(llvm::Function&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1643:27
    #14 0x4bb4a02 in llvm::FPPassManager::runOnModule(llvm::Module&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1678:16
    #15 0x4bb57c5 in runOnModule
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1743:27
    #16 0x4bb57c5 in llvm::legacy::PassManagerImpl::run(llvm::Module&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1856
    #17 0xa512ea in compileModule(char**, llvm::LLVMContext&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/llc/llc.cpp:596:8
    #18 0xa4ad10 in main
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/llc/llc.cpp:350:22
    #19 0x7fbdc37982e0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #20 0x939159 in _start
(/b/sanitizer-x86_64-linux-bootstrap/build/llvm_build_asan/bin/llc+0x939159)

0x62100004512a is located 1066 bytes inside of 4096-byte region
[0x621000044d00,0x621000045d00)
allocated by thread T0 here:
    #0 0xa0896f in malloc
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:145
    #1 0xa87bd6 in safe_malloc
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/MemAlloc.h:26:18
    #2 0xa87bd6 in Allocate
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/Allocator.h:99
    #3 0xa87bd6 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
4096ul, 4096ul>::StartNewSlab()
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/Allocator.h:400
    #4 0xa87909 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
4096ul, 4096ul>::Allocate(unsigned long, unsigned long)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/Allocator.h:260:5
    #5 0x59c449b in Allocate<llvm::RegisterSDNode,
llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096> >
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/Recycler.h:89:57
    #6 0x59c449b in Allocate<llvm::RegisterSDNode>
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/RecyclingAllocator.h:43
    #7 0x59c449b in newSDNode<llvm::RegisterSDNode, unsigned int &,
llvm::EVT &> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/CodeGen/SelectionDAG.h:338
    #8 0x59c449b in llvm::SelectionDAG::getRegister(unsigned int,
llvm::EVT) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1736
    #9 0xbe7788 in getCopyFromReg
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/CodeGen/SelectionDAG.h:706:30
    #10 0xbe7788 in
llvm::AArch64TargetLowering::LowerFormalArguments(llvm::SDValue,
unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&,
llvm::SDLoc const&, llvm::SelectionDAG&,
llvm::SmallVectorImpl<llvm::SDValue>&) const
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:3095
    #11 0x594db68 in
llvm::SelectionDAGISel::LowerArguments(llvm::Function const&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:9157:26
    #12 0x5a99180 in
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1589:5
    #13 0x5a92941 in
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:496:3
    #14 0x411288a in
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:13
    #15 0x4bb42e1 in
llvm::FPPassManager::runOnFunction(llvm::Function&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1643:27
    #16 0x4bb4a02 in llvm::FPPassManager::runOnModule(llvm::Module&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1678:16
    #17 0x4bb57c5 in runOnModule
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1743:27
    #18 0x4bb57c5 in llvm::legacy::PassManagerImpl::run(llvm::Module&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/LegacyPassManager.cpp:1856
    #19 0xa512ea in compileModule(char**, llvm::LLVMContext&)
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/llc/llc.cpp:596:8
    #20 0xa4ad10 in main
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/llc/llc.cpp:350:22
    #21 0x7fbdc37982e0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

SUMMARY: AddressSanitizer: use-after-poison
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:975:5
in getValueTypeShadow bytes around the buggy address:
  0x0c42800009d0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 02 f7 f7 f7 f7
  0x0c42800009e0: f7 f7 f7 f7 f7 f7 00 00 00 00 00 00 00 00 00 00
  0x0c42800009f0: 00 00 00 f7 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4280000a00: 00 f7 00 00 00 00 00 00 00 00 00 00 00 00 00 f7
  0x0c4280000a10: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 f7 f7
=>0x0c4280000a20: f7 02 f7 f7 f7[f7]f7 f7 f7 f7 f7 f7 00 00 00 00
  0x0c4280000a30: 00 00 00 00 00 00 00 00 00 f7 00 00 00 00 00 00
  0x0c4280000a40: 00 00 00 00 00 00 00 f7 00 00 00 00 00 00 00 00
  0x0c4280000a50: 00 00 00 00 00 f7 00 00 00 00 00 00 00 00 00 00
  0x0c4280000a60: 00 00 00 f7 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4280000a70: 00 f7 00 00 00 00 00 00 00 00 00 00 00 00 00 f7
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==25312==ABORTING
FileCheck error: '-' is empty.
FileCheck command line:
/b/sanitizer-x86_64-linux-bootstrap/build/llvm_build_asan/bin/FileCheck
/b/sanitizer-x86_64-linux-bootstrap/build/llvm/test/CodeGen/AArch64/bswap-known-bits.ll



On Thu, Feb 7, 2019 at 8:57 AM Nirav Dave via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: niravd
> Date: Thu Feb  7 08:57:50 2019
> New Revision: 353426
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353426&view=rev
> Log:
> [DAG] Cleanup unused node on failed SELECT Combine.
>
> Modified:
>     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=353426&r1=353425&r2=353426&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb  7
> 08:57:50 2019
> @@ -7444,6 +7444,9 @@ SDValue DAGCombiner::visitSELECT(SDNode
>        if (normalizeToSequence || !InnerSelect.use_empty())
>          return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0,
>                             InnerSelect, N2);
> +      // Cleanup on failure.
> +      if (InnerSelect.use_empty())
> +        recursivelyDeleteUnusedNodes(InnerSelect.getNode());
>      }
>      // select (or Cond0, Cond1), X, Y -> select Cond0, X, (select Cond1,
> X, Y)
>      if (N0->getOpcode() == ISD::OR && N0->hasOneUse()) {
> @@ -7454,6 +7457,9 @@ SDValue DAGCombiner::visitSELECT(SDNode
>        if (normalizeToSequence || !InnerSelect.use_empty())
>          return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0, N1,
>                             InnerSelect);
> +      // Cleanup on failure.
> +      if (InnerSelect.use_empty())
> +        recursivelyDeleteUnusedNodes(InnerSelect.getNode());
>      }
>
>      // select Cond0, (select Cond1, X, Y), Y -> select (and Cond0,
> Cond1), X, Y
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190207/a1b07b4d/attachment.html>


More information about the llvm-commits mailing list