yaxunl added inline comments.
================ Comment at: lib/CodeGen/CGBuiltin.cpp:3342 auto *AT = llvm::ArrayType::get(SizeTy, NumArgs - First); + // Always insert the alloca in the entry block so it remains static in + // the SelectionDAG. + BasicBlock *Begin = nullptr; + if (Instruction *Entry = CurFn->getEntryBlock().getTerminator()) { + Begin = Builder.GetInsertBlock(); + Builder.SetInsertPoint(Entry); + } auto *Arr = Builder.CreateAlloca(AT); llvm::Value *Ptr; ---------------- You may try CreateMemTemp. It should handle the insert position and also debug info. ================ Comment at: test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl:2 +// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn | FileCheck %s --check-prefixes=COMMON,AMDGPU +// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,SPIR32 +// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,SPIR64 ---------------- Can we have a run line for debug info? Repository: rC Clang https://reviews.llvm.org/D50104 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits