libclc build broken on clang/llvm master

Hi Tom,

I noticed that libclc is failing to build for me today using the
latest llvm/clang code checked out from git.

Through bisecting, I was able to narrow the issue down to the
following clang commit:
commit 9a3d2bd6da5028567cbfda65bec886b1bcea45e2
Author: Tom Stellard <thomas.stellard@amd.com>

    R600: Add local address pointer size to DataLayout

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189302 91177308-0d34

By reverting that commit from clang master, I could get libclc to build again.

Is there an associated change that we need to make to libclc to handle
the pointer size work that you did for llvm/clang, or is there
something incomplete in the llvm/clang changes?

--Aaron

The error in full is below:
LLVM-CC r600--/lib/shared/vstore.cl.tahiti.bc
clang: /home/awatry/src/llvm/lib/Analysis/ScalarEvolution.cpp:1471:
const llvm::SCEV*
llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<const
llvm::SCEV*>&, llvm::SCEV::NoWrapFlags): Assertion
`getEffectiveSCEVType(Ops[i]->getType()) == ETy && "SCEVAddExpr
operand types don't match!"' failed.
0 libLLVM-3.4svn.so 0x00002b7a518e2a12
llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1 libLLVM-3.4svn.so 0x00002b7a518e26c9
2 libpthread.so.0 0x00002ad70371cbd0
3 libc.so.6 0x00002adc7feef037 gsignal + 55
4 libc.so.6 0x00002adc7fef2698 abort + 328
5 libc.so.6 0x00002adc7fee7e03
6 libc.so.6 0x00002adc7fee7eb2
7 libLLVM-3.4svn.so 0x00002b7a50fcf299
llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV
const*>&, llvm::SCEV::NoWrapFlags) + 7321
8 libLLVM-3.4svn.so 0x00002b7a50f261b7
9 libLLVM-3.4svn.so 0x00002b7a519b8238
10 libLLVM-3.4svn.so 0x00002b7a519beefb
11 libLLVM-3.4svn.so 0x00002b7a519c0cc4
12 libLLVM-3.4svn.so 0x00002b7a5135afcf
llvm::FPPassManager::runOnFunction(llvm::Function&) + 639
13 libLLVM-3.4svn.so 0x00002b7a5147b246
14 libLLVM-3.4svn.so 0x00002b7a5135ac6f
llvm::MPPassManager::runOnModule(llvm::Module&) + 655
15 libLLVM-3.4svn.so 0x00002b7a5135cc57
llvm::PassManagerImpl::run(llvm::Module&) + 199
16 clang 0x00000000007eaeda
clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&,
clang::LangOptions const&, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) + 3498
17 clang 0x00000000007e87df
18 clang 0x000000000095dae2 clang::ParseAST(clang::Sema&,
bool, bool) + 514
19 clang 0x00000000007e76e1
clang::CodeGenAction::ExecuteAction() + 97
20 clang 0x0000000000666f69 clang::FrontendAction::Execute() + 265
21 clang 0x000000000064793a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 346
22 clang 0x000000000062f1e2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1874
23 clang 0x0000000000629d18 cc1_main(char const**, char
const**, char const*, void*) + 952
24 clang 0x0000000000628b27 main + 7559
25 libc.so.6 0x00002adc7fed9ea5 __libc_start_main + 245
26 clang 0x00000000006297c1
Stack dump:
0. Program arguments: /usr/local/bin/clang -cc1 -triple r600--
-emit-llvm-bc -disable-free -main-file-name vstore.cl
-mrelocation-model static -mdisable-fp-elim -fmath-errno
-mconstructor-aliases -target-cpu tahiti -target-linker-version 2.23.2
-coverage-file /home/awatry/src/libclc/r600--/lib/shared/vstore.cl.tahiti.bc
-resource-dir /usr/local/bin/../lib/clang/3.4 -dependency-file
r600--/lib/shared/vstore.cl.tahiti.bc.d -MT
r600--/lib/shared/vstore.cl.tahiti.bc -D
cl_clang_storage_class_specifiers -D cl_khr_fp64 -I ./r600/lib/shared
-I ./generic/include -c-isystem /opt/AMDAPP/include -c-isystem .
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/awatry/src/libclc -ferror-limit 19 -fmessage-length 211
-mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
r600--/lib/shared/vstore.cl.tahiti.bc -x cl
./r600/lib/shared/vstore.cl
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'CallGraph Pass Manager' on module
'./r600/lib/shared/vstore.cl'.
4. Running pass 'SLP Vectorizer' on function '@_Z7vstore2Dv2_cmPU3AS3c'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to
see invocation)
clang version 3.4 (trunk 189357) (llvm/trunk 189349)
Target: r600--
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed
source, and associated run script.
clang: note: diagnostic msg:

Hi Tom,

I noticed that libclc is failing to build for me today using the
latest llvm/clang code checked out from git.

Through bisecting, I was able to narrow the issue down to the
following clang commit:
commit 9a3d2bd6da5028567cbfda65bec886b1bcea45e2
Author: Tom Stellard <thomas.stellard@amd.com>
Date: Tue Aug 27 00:55:26 2013 +0000

    R600: Add local address pointer size to DataLayout

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189302 91177308-0d34

Thanks for bisecting, this issue has been reported in the llvm bugzilla:
http://llvm.org/bugs/show_bug.cgi?id=17012

I will take a look at it.

-Tom