[llvm-bugs] [Bug 26424] New: [CodeGenPrepare] masked scatter/gather with bogus alignment causes assert

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 1 14:44:17 PST 2016


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

            Bug ID: 26424
           Summary: [CodeGenPrepare] masked scatter/gather with bogus
                    alignment causes assert
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I'm not sure who to blame for this one. In http://reviews.llvm.org/D16691 , I
noted that the IR verifier doesn't check for constant arg values, so maybe this
is a related problem.

In any case, I created some simple test cases for:
http://reviews.llvm.org/rL259421

The alignment parameter should be meaningless in these tests, so I just made
the value increase with each test. But when I send this IR to llc, it asserts:

$ cat gather.ll
declare <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32, <2 x
i1> %mask, <2 x double> %passthru)

define <2 x double> @gather_zeromask(<2 x double*> %ptrs, <2 x double>
%passthru)  {
  %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32
5, <2 x i1> zeroinitializer, <2 x double> %passthru)
  ret <2 x double> %res
}

$ ./llc gather.ll
Assertion failed: ((Align & (Align-1)) == 0 && "Alignment is not a power of
2!"), function setAlignment, file
/Users/spatel/myllvm/llvm/lib/IR/Instructions.cpp, line 1288.
0  llc                      0x00000001072c1d5e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  llc                      0x00000001072c21a9
PrintStackTraceSignalHandler(void*) + 25
2  llc                      0x00000001072be949 llvm::sys::RunSignalHandlers() +
425
3  llc                      0x00000001072c2509 SignalHandler(int) + 345
4  libsystem_platform.dylib 0x00007fff9d455eaa _sigtramp + 26
5  libsystem_platform.dylib 0x00007fff6b0c98e5 _sigtramp + 3452385877
6  llc                      0x00000001072c21cb raise + 27
7  llc                      0x00000001072c2282 abort + 18
8  llc                      0x00000001072c2261 __assert_rtn + 129
9  llc                      0x0000000106ab94b2
llvm::LoadInst::setAlignment(unsigned int) + 114
10 llc                      0x000000010531cdd8 llvm::IRBuilder<true,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true>
>::CreateAlignedLoad(llvm::Value*, unsigned int, llvm::Twine const&) + 56
11 llc                      0x000000010657976e
scalarizeMaskedGather(llvm::CallInst*) + 2062
12 llc                      0x000000010656abdb (anonymous
namespace)::CodeGenPrepare::optimizeCallInst(llvm::CallInst*, bool&) + 2667
13 llc                      0x00000001065654b4 (anonymous
namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, bool&) + 1876
14 llc                      0x0000000106563991 (anonymous
namespace)::CodeGenPrepare::optimizeBlock(llvm::BasicBlock&, bool&) + 257
15 llc                      0x0000000106561872 (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) + 1026
16 llc                      0x0000000106af760d
llvm::FPPassManager::runOnFunction(llvm::Function&) + 413
17 llc                      0x0000000106af7945
llvm::FPPassManager::runOnModule(llvm::Module&) + 117
18 llc                      0x0000000106af869a (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 2010
19 llc                      0x0000000106af7c2b
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 347
20 llc                      0x0000000106af92e1
llvm::legacy::PassManager::run(llvm::Module&) + 33
21 llc                      0x0000000104fc663c compileModule(char**,
llvm::LLVMContext&) + 19788
22 llc                      0x0000000104fc1886 main + 230
23 libdyld.dylib            0x00007fff8a4fa5ad start + 1
24 libdyld.dylib            0x0000000000000002 start + 1974491734
Stack dump:
0.    Program arguments: ./llc gather.ll 
1.    Running pass 'Function Pass Manager' on module 'gather.ll'.
2.    Running pass 'CodeGen Prepare' on function '@gather_zeromask'

-- 
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/20160201/357275dd/attachment.html>


More information about the llvm-bugs mailing list