Skip to content

Commit ba24945

Browse files
author
Greg Roth
committed
Correct mistaken merge
1 parent ea866f3 commit ba24945

File tree

2 files changed

+0
-135
lines changed

2 files changed

+0
-135
lines changed
Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
//===- DXILFinalizeLinkage.cpp - Finalize linkage of functions ------------===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -64,70 +63,3 @@ INITIALIZE_PASS_END(DXILFinalizeLinkageLegacy, DEBUG_TYPE,
6463
ModulePass *llvm::createDXILFinalizeLinkageLegacyPass() {
6564
return new DXILFinalizeLinkageLegacy();
6665
}
67-
=======
68-
//===- DXILFinalizeLinkage.cpp - Finalize linkage of functions ------------===//
69-
//
70-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
71-
// See https://llvm.org/LICENSE.txt for license information.
72-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
73-
//
74-
//===----------------------------------------------------------------------===//
75-
76-
#include "DXILFinalizeLinkage.h"
77-
#include "DirectX.h"
78-
#include "llvm/Analysis/DXILResource.h"
79-
#include "llvm/IR/Function.h"
80-
#include "llvm/IR/GlobalValue.h"
81-
#include "llvm/IR/Metadata.h"
82-
#include "llvm/IR/Module.h"
83-
84-
#define DEBUG_TYPE "dxil-finalize-linkage"
85-
86-
using namespace llvm;
87-
88-
static bool finalizeLinkage(Module &M) {
89-
SmallPtrSet<Function *, 8> EntriesAndExports;
90-
91-
// Find all entry points and export functions
92-
for (Function &EF : M.functions()) {
93-
if (!EF.hasFnAttribute("hlsl.shader") && !EF.hasFnAttribute("hlsl.export"))
94-
continue;
95-
EntriesAndExports.insert(&EF);
96-
}
97-
98-
for (Function &F : M.functions()) {
99-
if (F.getLinkage() == GlobalValue::ExternalLinkage &&
100-
!EntriesAndExports.contains(&F)) {
101-
F.setLinkage(GlobalValue::InternalLinkage);
102-
}
103-
}
104-
105-
return false;
106-
}
107-
108-
PreservedAnalyses DXILFinalizeLinkage::run(Module &M,
109-
ModuleAnalysisManager &AM) {
110-
if (finalizeLinkage(M))
111-
return PreservedAnalyses::none();
112-
return PreservedAnalyses::all();
113-
}
114-
115-
bool DXILFinalizeLinkageLegacy::runOnModule(Module &M) {
116-
return finalizeLinkage(M);
117-
}
118-
119-
void DXILFinalizeLinkageLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
120-
AU.addPreserved<DXILResourceWrapperPass>();
121-
}
122-
123-
char DXILFinalizeLinkageLegacy::ID = 0;
124-
125-
INITIALIZE_PASS_BEGIN(DXILFinalizeLinkageLegacy, DEBUG_TYPE,
126-
"DXIL Finalize Linkage", false, false)
127-
INITIALIZE_PASS_END(DXILFinalizeLinkageLegacy, DEBUG_TYPE,
128-
"DXIL Finalize Linkage", false, false)
129-
130-
ModulePass *llvm::createDXILFinalizeLinkageLegacyPass() {
131-
return new DXILFinalizeLinkageLegacy();
132-
}
133-
>>>>>>> refs/remotes/origin/main
Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s
32
; RUN: llc %s --filetype=asm -o - | FileCheck %s --check-prefixes=CHECK-LLC
43

@@ -63,69 +62,3 @@ attributes #3 = { convergent }
6362

6463
; Make sure "hlsl.export" attribute is stripped by llc
6564
; CHECK-LLC-NOT: "hlsl.export"
66-
=======
67-
; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s
68-
; RUN: llc %s --filetype=asm -o - | FileCheck %s --check-prefixes=CHECK-LLC
69-
70-
target triple = "dxilv1.5-pc-shadermodel6.5-compute"
71-
72-
; DXILFinalizeLinkage changes linkage of all functions that are not
73-
; entry points or exported function to internal.
74-
75-
; CHECK: define internal void @"?f1@@YAXXZ"()
76-
define void @"?f1@@YAXXZ"() #0 {
77-
entry:
78-
ret void
79-
}
80-
81-
; CHECK: define internal void @"?f2@@YAXXZ"()
82-
define void @"?f2@@YAXXZ"() #0 {
83-
entry:
84-
ret void
85-
}
86-
87-
; CHECK: define internal void @"?f3@@YAXXZ"()
88-
define void @"?f3@@YAXXZ"() #0 {
89-
entry:
90-
ret void
91-
}
92-
93-
; CHECK: define internal void @"?foo@@YAXXZ"()
94-
define void @"?foo@@YAXXZ"() #0 {
95-
entry:
96-
call void @"?f2@@YAXXZ"() #3
97-
ret void
98-
}
99-
100-
; Exported function - do not change linkage
101-
; CHECK: define void @"?bar@@YAXXZ"()
102-
define void @"?bar@@YAXXZ"() #1 {
103-
entry:
104-
call void @"?f3@@YAXXZ"() #3
105-
ret void
106-
}
107-
108-
; CHECK: define internal void @"?main@@YAXXZ"() #0
109-
define internal void @"?main@@YAXXZ"() #0 {
110-
entry:
111-
call void @"?foo@@YAXXZ"() #3
112-
call void @"?bar@@YAXXZ"() #3
113-
ret void
114-
}
115-
116-
; Entry point function - do not change linkage
117-
; CHECK: define void @main() #2
118-
define void @main() #2 {
119-
entry:
120-
call void @"?main@@YAXXZ"()
121-
ret void
122-
}
123-
124-
attributes #0 = { convergent noinline nounwind optnone}
125-
attributes #1 = { convergent noinline nounwind optnone "hlsl.export"}
126-
attributes #2 = { convergent "hlsl.numthreads"="4,1,1" "hlsl.shader"="compute"}
127-
attributes #3 = { convergent }
128-
129-
; Make sure "hlsl.export" attribute is stripped by llc
130-
; CHECK-LLC-NOT: "hlsl.export"
131-
>>>>>>> refs/remotes/origin/main

0 commit comments

Comments
 (0)