-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23894 from JuliaLang/yyc/tests/llvm40
Add another LLVM patch for non-integral ptrtoint fix on LLVM 4.0
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
From 01ae2614aa184fcf88b0880f5944a23da6f215db Mon Sep 17 00:00:00 2001 | ||
From: Yichao Yu <yyc1992@gmail.com> | ||
Date: Sun, 18 Jun 2017 16:45:38 -0400 | ||
Subject: [PATCH] Disable LoadCSE and Store forwarding between different | ||
address space or between non-integral pointer and integers. | ||
|
||
--- | ||
lib/Analysis/Loads.cpp | 30 ++++++++++++++++++++++++++++++ | ||
1 file changed, 30 insertions(+) | ||
|
||
diff --git a/lib/Analysis/Loads.cpp b/lib/Analysis/Loads.cpp | ||
index e46541e6538..971ce37a4a5 100644 | ||
--- a/lib/Analysis/Loads.cpp | ||
+++ b/lib/Analysis/Loads.cpp | ||
@@ -362,6 +362,21 @@ Value *llvm::FindAvailableLoadedValue(LoadInst *Load, | ||
if (LI->isAtomic() < Load->isAtomic()) | ||
return nullptr; | ||
|
||
+ if (Load->getType()->isPointerTy()) { | ||
+ PointerType *Ty1 = cast<PointerType>(Load->getType()); | ||
+ if (PointerType *Ty2 = dyn_cast<PointerType>(LI->getType())) { | ||
+ if (Ty1->getAddressSpace() != Ty2->getAddressSpace()) { | ||
+ return nullptr; | ||
+ } | ||
+ } | ||
+ else if (DL.isNonIntegralPointerType(Ty1)) { | ||
+ return nullptr; | ||
+ } | ||
+ } | ||
+ else if (DL.isNonIntegralPointerType(LI->getType())) { | ||
+ return nullptr; | ||
+ } | ||
+ | ||
if (IsLoadCSE) | ||
*IsLoadCSE = true; | ||
return LI; | ||
@@ -381,6 +396,21 @@ Value *llvm::FindAvailableLoadedValue(LoadInst *Load, | ||
if (SI->isAtomic() < Load->isAtomic()) | ||
return nullptr; | ||
|
||
+ if (Load->getType()->isPointerTy()) { | ||
+ PointerType *Ty1 = cast<PointerType>(Load->getType()); | ||
+ if (PointerType *Ty2 = dyn_cast<PointerType>(SI->getValueOperand()->getType())) { | ||
+ if (Ty1->getAddressSpace() != Ty2->getAddressSpace()) { | ||
+ return nullptr; | ||
+ } | ||
+ } | ||
+ else if (DL.isNonIntegralPointerType(Ty1)) { | ||
+ return nullptr; | ||
+ } | ||
+ } | ||
+ else if (DL.isNonIntegralPointerType(SI->getValueOperand()->getType())) { | ||
+ return nullptr; | ||
+ } | ||
+ | ||
if (IsLoadCSE) | ||
*IsLoadCSE = false; | ||
return SI->getOperand(0); | ||
-- | ||
2.13.1 | ||
|