Skip to content

Commit

Permalink
Merge pull request #25537 from JuliaLang/tb/llvm_addrspace
Browse files Browse the repository at this point in the history
Apply a forgotten patch to LLVM >3.9
  • Loading branch information
maleadt authored Jan 20, 2018
2 parents 625923f + ae29df5 commit 9028130
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# treat patches as files that should not be modified
*.patch -text
2 changes: 2 additions & 0 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ $(eval $(call LLVM_PATCH,llvm-D32208-coerce-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-D32623-GVN-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-D33129-scevexpander-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-Yet-another-fix))
$(eval $(call LLVM_PATCH,llvm-NVPTX-addrspaces)) # NVPTX
$(eval $(call LLVM_PATCH,llvm-4.0.0-D37576-NVPTX-sm_70)) # NVPTX, Remove for 6.0
$(eval $(call LLVM_PATCH,llvm-loadcse-addrspace_4.0))
ifeq ($(BUILD_LLVM_CLANG),1)
Expand All @@ -497,6 +498,7 @@ $(eval $(call LLVM_PATCH,llvm-3.9.0_D27296-libssp))
$(eval $(call LLVM_PATCH,llvm-D27629-AArch64-large_model_4.0))
$(eval $(call LLVM_PATCH,llvm-loadcse-addrspace_5.0))
$(eval $(call LLVM_PATCH,llvm-D34078-vectorize-fdiv))
$(eval $(call LLVM_PATCH,llvm-5.0-NVPTX-addrspaces)) # NVPTX
$(eval $(call LLVM_PATCH,llvm-4.0.0-D37576-NVPTX-sm_70)) # NVPTX, Remove for 6.0
$(eval $(call LLVM_PATCH,llvm-D38765-gvn_5.0)) # Remove for 6.0
endif # LLVM_VER
Expand Down
30 changes: 30 additions & 0 deletions deps/patches/llvm-5.0-NVPTX-addrspaces.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff -ru llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.cpp llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.cpp
--- llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.cpp 2017-07-12 22:49:21.000000000 +0200
+++ llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.cpp 2018-01-13 09:08:17.275987874 +0100
@@ -1235,6 +1235,14 @@
}
}

+bool NVPTXTargetLowering::isNoopAddrSpaceCast(unsigned SrcAS,
+ unsigned DestAS) const {
+ assert(SrcAS != DestAS && "Expected different address spaces!");
+
+ return (SrcAS == ADDRESS_SPACE_GENERIC || SrcAS > ADDRESS_SPACE_LOCAL) &&
+ (DestAS == ADDRESS_SPACE_GENERIC || DestAS > ADDRESS_SPACE_LOCAL);
+}
+
SDValue
NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
SDLoc dl(Op);
diff -ru llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.h llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.h
--- llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.h 2018-01-13 09:07:48.839643576 +0100
+++ llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.h 2018-01-13 09:06:18.658551692 +0100
@@ -443,6 +443,8 @@
const NVPTXSubtarget &STI);
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;

+ bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
+
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;

const char *getTargetNodeName(unsigned Opcode) const override;

0 comments on commit 9028130

Please sign in to comment.