[llvm-bugs] [Bug 27146] New: LICM's AliasSetTracker is holding deleted values

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 30 15:50:58 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27146

            Bug ID: 27146
           Summary: LICM's AliasSetTracker is holding deleted values
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: lawrence at codeaurora.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16134
  --> https://llvm.org/bugs/attachment.cgi?id=16134&action=edit
reduced testcase

A problem similar to bug 3787.

If I run loop reroll after LICM, I will hit the following Assert:

An asserting value handle still pointed to this value!
UNREACHABLE executed at
/prj/llvm-arm/home/lawrence/llvmtrunk_latest/src/llvm/lib/IR/Value.cpp:744!
#0 0x00000000010f9548 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x10f9548)
#1 0x00000000010f7a56 llvm::sys::RunSignalHandlers()
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x10f7a56)
#2 0x00000000010f9d69 SignalHandler(int)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x10f9d69)
#3 0x00007f1b2e6decb0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0xfcb0)
#4 0x00007f1b2da200d5 gsignal
/build/eglibc-rrybNj/eglibc-2.15/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:64:0
#5 0x00007f1b2da2383b abort
/build/eglibc-rrybNj/eglibc-2.15/stdlib/abort.c:93:0
#6 0x00000000010b147d llvm::llvm_unreachable_internal(char const*, char const*,
unsigned int)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x10b147d)
#7 0x0000000000d53e6c llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xd53e6c)
#8 0x0000000000d5371b llvm::Value::~Value()
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xd5371b)
#9 0x0000000000cfd739 llvm::CallInst::~CallInst()
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xcfd739)
#10 0x0000000000cfa076 llvm::Instruction::eraseFromParent()
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xcfa076)
#11 0x0000000000fb499d (anonymous
namespace)::LoopReroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xfb499d)
#12 0x0000000000957e9e llvm::LPPassManager::runOnFunction(llvm::Function&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x957e9e)
#13 0x0000000000d2409d llvm::FPPassManager::runOnFunction(llvm::Function&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xd2409d)
#14 0x0000000000d242eb llvm::FPPassManager::runOnModule(llvm::Module&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xd242eb)
#15 0x0000000000d24892 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0xd24892)
#16 0x00000000005b3f5b main
(/prj/llvm-arm/home/lawrence/llvmtrunk_latest/build_release/llvm/bin/opt+0x5b3f5b)
#17 0x00007f1b2da0b76d __libc_start_main
/build/eglibc-rrybNj/eglibc-2.15/csu/libc-start.c:258:0

The problem is that LICM is designed to do runOnLoop for all the loop first,
then go to next opt, because it keep the AliasSetTracker around for outer loop,
AliasSetTracker created the ValueHandle (type Assert), without destructing the
AliasSetTracker, the ValueHandle will be kept around. Then if we run any other
opt after LICM (before destructing AliasSetTracker), we will run into this kind
of Assert.

I am thinking either we have to destruct AliasSetTracker every time in LICM; Or
we have to pass a flag to LICM to destruct AliasSetTracker if flag is set.

Any thoughts or suggestion?


Command to reproduce:
bin/opt -licm -loop-reroll -debug-only=loop-reroll -S t.ll

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160330/71861985/attachment-0001.html>


More information about the llvm-bugs mailing list