File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
test/Conversion/GPUToNVVM Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,12 @@ struct OpToFuncCallLowering : public ConvertOpToLLVMPattern<SourceOp> {
164164 auto parentFunc = op->getParentOfType <FunctionOpInterface>();
165165 assert (parentFunc && " expected there to be a parent function" );
166166 OpBuilder b (parentFunc);
167- return b.create <LLVMFuncOp>(op->getLoc (), funcName, funcType);
167+
168+ // Create a valid global location removing any metadata attached to the
169+ // location as debug info metadata inside of a function cannot be used
170+ // outside of that function.
171+ auto globalloc = op->getLoc ()->findInstanceOfOrUnknown <FileLineColLoc>();
172+ return b.create <LLVMFuncOp>(globalloc, funcName, funcType);
168173 }
169174
170175 StringRef getFunctionName (Type type, SourceOp op) const {
Original file line number Diff line number Diff line change @@ -23,3 +23,12 @@ gpu.module @test_module_1 {
2323 gpu.return
2424 }
2525}
26+
27+ // Check that debug info metadata from the function is removed from the global location.
28+ gpu.module @test_module_2 {
29+ // CHECK-DAG: llvm.func @__nv_abs(i32) -> i32 loc([[LOC]])
30+ func.func @gpu_abs_with_loc (%arg_i32 : i32 ) -> (i32 ) {
31+ %result32 = math.absi %arg_i32 : i32 loc (fused <#di_subprogram >[#loc ])
32+ func.return %result32 : i32
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments