[llvm-bugs] [Bug 36195] New: Assertion `!hasScalarValue(Key, Instance) && "Scalar value already set"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 1 07:54:20 PST 2018


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

            Bug ID: 36195
           Summary: Assertion `!hasScalarValue(Key, Instance) && "Scalar
                    value already set"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: karl-johan.karlsson at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19793
  --> https://bugs.llvm.org/attachment.cgi?id=19793&action=edit
llasm reproducer

Let's consider the following code (also attached):

@a = local_unnamed_addr global [4 x i16] zeroinitializer
@b = local_unnamed_addr global i32 0

; Function Attrs: norecurse nounwind
define void @f1() local_unnamed_addr {
  store i32 0, i32* @b, align 1
  br label %bb1

bb1:                                              ; preds = %0, %bb1
  %cse1.1.0 = phi i32 [ 0, %0 ], [ %_tmp13, %bb1 ]
  %_tmp8 = and i32 %cse1.1.0, 65535
  %1 = trunc i32 %cse1.1.0 to i16
  %_tmp10 = getelementptr [4 x i16], [4 x i16]* @a, i16 0, i16 %1
  store i16 1, i16* %_tmp10, align 1
  %_tmp13 = add nuw nsw i32 %_tmp8, 1
  %_tmp17 = trunc i32 %_tmp13 to i16
  %_tmp19 = icmp ult i16 %_tmp17, 4
  br i1 %_tmp19, label %bb1, label %bb3

bb3:                                              ; preds = %bb1
  store i32 4, i32* @b, align 1
  ret void
}

Running the loop vectorizer on this input give this assert:

$ ./opt -mtriple=x86-linux -loop-vectorize -S -o /dev/null foo.ll
opt: ../lib/Transforms/Vectorize/VPlan.h:173: void
llvm::VectorizerValueMap::setScalarValue(llvm::Value *, const llvm::VPIteration
&, llvm::Value *): Assertion `!hasScalarValue(Key, Instance) && "Scalar value
already set"' failed.
#0 0x0000000001ebe0f4 PrintStackTraceSignalHandler(void*) (./opt+0x1ebe0f4)
#1 0x0000000001ebe866 SignalHandler(int) (./opt+0x1ebe866)
#2 0x00007f9f2bbe2330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007f9f2a7d1c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f9f2a7d5028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007f9f2a7cabf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#6 0x00007f9f2a7caca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x0000000001fbc673 llvm::VectorizerValueMap::setScalarValue(llvm::Value*,
llvm::VPIteration const&, llvm::Value*) (./opt+0x1fbc673)
#8 0x0000000001fbd443 llvm::InnerLoopVectorizer::buildScalarSteps(llvm::Value*,
llvm::Value*, llvm::Value*, llvm::InductionDescriptor const&) (./opt+0x1fbd443)
#9 0x0000000001fbcf41
llvm::InnerLoopVectorizer::widenIntOrFpInduction(llvm::PHINode*,
llvm::TruncInst*) (./opt+0x1fbcf41)
#10 0x000000000202827e llvm::VPBasicBlock::execute(llvm::VPTransformState*)
(./opt+0x202827e)
#11 0x000000000202925d llvm::VPlan::execute(llvm::VPTransformState*)
(./opt+0x202925d)
#12 0x0000000001fde247
llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&,
llvm::DominatorTree*) (./opt+0x1fde247)
#13 0x0000000001fe792d llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(./opt+0x1fe792d)
#14 0x0000000001fe99b3 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&) (./opt+0x1fe99b3)
#15 0x0000000001ff36cb (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&) (./opt+0x1ff36cb)
#16 0x0000000001975598 llvm::FPPassManager::runOnFunction(llvm::Function&)
(./opt+0x1975598)
#17 0x00000000019757d8 llvm::FPPassManager::runOnModule(llvm::Module&)
(./opt+0x19757d8)
#18 0x0000000001975cb5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(./opt+0x1975cb5)
#19 0x0000000000729b63 main (./opt+0x729b63)
#20 0x00007f9f2a7bcf45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#21 0x0000000000714a0d _start (./opt+0x714a0d)
Stack dump:
0.      Program arguments: ./opt -mtriple=x86-linux -loop-vectorize -S -o
/dev/null foo.ll 
1.      Running pass 'Function Pass Manager' on module 'foo.ll'.
2.      Running pass 'Loop Vectorization' on function '@f1'
Aborted (core dumped)

-- 
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/20180201/222d650f/attachment.html>


More information about the llvm-bugs mailing list