[PATCH] D29717: [LoopVectorize] Added address space check when analysing interleaved accesses

Karl-Johan Karlsson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 06:08:44 PST 2017


I added Eli Friedman as he was in the discussion in the original review.

On 2017-02-17 13:43, Matthew Simpson wrote:
> I would definitely expect to have pointer types here. The SCEVs are
> collected by collectConstStrideAccesses and replaceSymbolicStrideSCEV.
> Maybe you've uncovered a bug there somewhere?

I have been able to reproduce the buildbot fault locally, but as it is a 
ThinLTO build it is really complicated to extract a small llvm-assembler 
reproducer.

In gdb standing at my added address space check in 
InterleavedAccessInfo::analyzeInterleaving().

Is it a fault that DesA.Scev is not of pointer type?


(gdb) call DesA.Scev->getType()->dump()
i64
(gdb) call DesB.Scev->getType()->dump()
i8*
(gdb) call DesA.Scev->dump()
{16,+,32}<nuw><%73>
(gdb) call DesB.Scev->dump()
{(24 + %49)<nsw>,+,32}<nw><%73>
(gdb) call A->dump()
   store i8* bitcast (i64* getelementptr inbounds ([0 x i64], [0 x i64]* 
@_ZNSs4_Rep20_S_empty_rep_storageE, i64 0, i64 3) to i8*), i8** %90, 
align 8, !tbaa !102
(gdb) call B->dump()
   store i64 %95, i64* %94, align 8

(gdb) call A->getParent()->dump()

; <label>:73:                                     ; preds = %69, %73
   %74 = phi %"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* [ %97, 
%73 ], [ %50, %69 ]
   %75 = phi %"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* [ %96, 
%73 ], [ null, %69 ]
   %76 = bitcast %"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75 to i64*
   %77 = load i64, i64* %76, align 8, !tbaa !98
   %78 = bitcast %"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %74 to i64*
   store i64 %77, i64* %78, align 8, !tbaa !98
   %79 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75, 
i64 0, i32 0, i32 0, i32 0, i32 0
   store i8* bitcast (i64* getelementptr inbounds ([0 x i64], [0 x i64]* 
@_ZNSs4_Rep20_S_empty_rep_storageE, i64 0, i64 3) to i8*), i8** %79, 
align 8, !tbaa !102
   %80 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %74, 
i64 0, i32 0, i32 1
   %81 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75, 
i64 0, i32 0, i32 1
   %82 = bitcast i32* %81 to i64*
   %83 = bitcast i32* %80 to i64*
   %84 = load i64, i64* %82, align 8
   store i64 %84, i64* %83, align 8
   %85 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %74, 
i64 0, i32 1
   %86 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75, 
i64 0, i32 1
   %87 = bitcast %"class.std::basic_string"* %86 to i64*
   %88 = load i64, i64* %87, align 8, !tbaa !98
   %89 = bitcast %"class.std::basic_string"* %85 to i64*
   store i64 %88, i64* %89, align 8, !tbaa !98
   %90 = getelementptr inbounds %"class.std::basic_string", 
%"class.std::basic_string"* %86, i64 0, i32 0, i32 0
   store i8* bitcast (i64* getelementptr inbounds ([0 x i64], [0 x i64]* 
@_ZNSs4_Rep20_S_empty_rep_storageE, i64 0, i64 3) to i8*), i8** %90, 
align 8, !tbaa !102
   %91 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %74, 
i64 0, i32 2
   %92 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75, 
i64 0, i32 2
   %93 = bitcast i32* %92 to i64*
   %94 = bitcast i32* %91 to i64*
   %95 = load i64, i64* %93, align 8
   store i64 %95, i64* %94, align 8
   %96 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %75, i64 1
   %97 = getelementptr inbounds 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch", 
%"struct.clang::ExpectedLocationVisitor<(anonymous 
namespace)::IntegerLiteralVisitor, TestVisitor>::ExpectedMatch"* %74, i64 1
   br i1 false, label %98, label %73


> On Fri, Feb 17, 2017 at 3:22 AM, Karl-Johan Karlsson via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
>     As I wrote earlier I had to revert the change due to a buildbot
>     error in clang-with-thin-lto-ubuntu build #1847 step
>     build-stage3-compiler. I have tried to recreate the buildbot fault,
>     but failed to do so.
>
>     http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/1847/steps/build-stage3-compiler
>     <http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/1847/steps/build-stage3-compiler>
>
>     When looking at the stacktrace from the buildbot failure it seems like
>     either the type of DesA.Scev or DesB.Scev is not a pointer (in
>     InterleavedAccessInfo::analyzeInterleaving()). Isn't that a bit strange?
>
>     Stack trace:
>     ld.lld:
>     /home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/llvm.src/include/llvm/Support/Casting.h:236:
>     typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X =
>     llvm::PointerType, Y = llvm::Type]: Assertion `isa<X>(Val) &&
>     "cast<Ty>() argument of incompatible type!"' failed.
>     #0 0x0000000000489824 PrintStackTraceSignalHandler(void*)
>     (/home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/install/stage2/bin/ld.lld+0x489824)
>     #1 0x0000000000489b76 SignalHandler(int)
>     (/home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/install/stage2/bin/ld.lld+0x489b76)
>     #2 0x00007fda0bb58330 __restore_rt
>     (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
>     #3 0x00007fda0ab8dc37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
>     #4 0x00007fda0ab91028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
>     #5 0x00007fda0ab86bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
>     #6 0x00007fda0ab86ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
>     #7 0x00000000019c7d97 (anonymous
>     namespace)::LoopVectorizationLegality::canVectorize()
>     (/home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/install/stage2/bin/ld.lld+0x19c7d97)
>     #8 0x00000000019bc33c
>     llvm::LoopVectorizePass::processLoop(llvm::Loop*)
>     (/home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/install/stage2/bin/ld.lld+0x19bc33c)
>     #9 0x00000000019ca153
>     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&)
>     (/home/buildbot/Buildbot/Slave1a/clang-with-thin-lto-ubuntu/install/stage2/bin/ld.lld+0x19ca153)
>
>     Should it really be necessary to add pointer checks in the address
>     space check?
>
>     Regards
>     / Karl-Johan Karlsson
>
>
>     On 2017-02-14 14:26, Karl-Johan Karlsson via Phabricator wrote:
>
>         Ka-Ka added a comment.
>
>         I had to revert this change due to a buildbot failure. I'm
>         trying to recreate the fault locally ...
>
>
>         Repository:
>           rL LLVM
>
>         https://reviews.llvm.org/D29717 <https://reviews.llvm.org/D29717>
>
>
>
>
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
>


More information about the llvm-commits mailing list