[LLVMbugs] [Bug 14349] New: Assertion in SROA around rewriting store instruction implicitly using a vector data type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 14 17:26:57 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14349

             Bug #: 14349
           Summary: Assertion in SROA around rewriting store instruction
                    implicitly using a vector data type
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: liujiangning1 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hi,

For the following case,

$ cat bad1.ll
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"

define internal void @test(i32 %v) {
entry:
  %tmp = alloca i32, align 4
  store i32 %v, i32* %tmp, align 4
  %0 = bitcast i32* %tmp to <2 x i8>*
  %1 = load <2 x i8>* %0, align 4
  ret void
}

I have the following failure message for command line "opt -sroa bad.ll -o
bad.bc".

$ opt -sroa bad.ll -o bad.bc
opt: llvm/lib/Transforms/Scalar/SROA.cpp:2063: llvm::Value* convertValue(const
llvm::DataLayout&, llvm::IRBuilder<>&, llvm::Value*, llvm::Type*): Assertion
`canConvertValue(DL, V->getType(), Ty) && "Value not convertable to type"'
failed.
0  opt       0x08f44f52
1  opt       0x08f44bac
2            0xb7736400 __kernel_sigreturn + 0
3            0xb7736424 __kernel_vsyscall + 16
4  libc.so.6 0xb7482c8f gsignal + 79
5  libc.so.6 0xb74862b5 abort + 373
6  libc.so.6 0xb747b826 __assert_fail + 246
7  opt       0x08b109d7
8  opt       0x08b135ef
9  opt       0x08b13b15
10 opt       0x08b1fea4
11 opt       0x08b1d7e1
12 opt       0x08b1adbc
13 opt       0x08b11ec8
14 opt       0x08b18177
15 opt       0x08b182c5
16 opt       0x08b186fc
17 opt       0x08b19142
18 opt       0x08e62c4a llvm::FPPassManager::runOnFunction(llvm::Function&) +
306
19 opt       0x08e62dfe llvm::FPPassManager::runOnModule(llvm::Module&) + 114
20 opt       0x08e630cc llvm::MPPassManager::runOnModule(llvm::Module&) + 400
21 opt       0x08e635b6 llvm::PassManagerImpl::run(llvm::Module&) + 122
22 opt       0x08e63749 llvm::PassManager::run(llvm::Module&) + 39
23 opt       0x084556a5 main + 5635
24 libc.so.6 0xb746e113 __libc_start_main + 243
25 opt       0x08445bf1
Stack dump:
0.    Program arguments: opt -sroa bad.ll -o bad.bc 
1.    Running pass 'Function Pass Manager' on module 'bad.ll'.
2.    Running pass 'SROA' on function '@_Z7vstore2Dv2_cjPU10AS16776960c'
Aborted

Is it a bug in SROA?

With the following patch, it seems the problem can be fixed. Any idea?

diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index d95c855..696107a 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -2608,8 +2608,6 @@ private:
     assert(OldOp == OldPtr);
     IRBuilder<> IRB(&SI);

-    if (VecTy)
-      return rewriteVectorizedStoreInst(IRB, SI, OldOp);
     Type *ValueTy = SI.getValueOperand()->getType();

     uint64_t Size = EndOffset - BeginOffset;
@@ -2644,6 +2642,9 @@ private:
       return IsConvertable;
     }

+    if (VecTy)
+      return rewriteVectorizedStoreInst(IRB, SI, OldOp);
+
     if (IntTy && ValueTy->isIntegerTy())
       return rewriteIntegerStore(IRB, SI);

Thanks,
-Jiangning

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list