diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-01-31 01:30:16 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-01-31 01:30:16 +0000 |
commit | d89a6e11a78c781184544c05e2619c4d010718d6 (patch) | |
tree | e6306b418bd23a9d18b9a200438f4473a8fdd3e3 /llvm/lib/Transforms | |
parent | 8335dd314f369fd885b220a48be3af7fbdb0d584 (diff) | |
download | bcm5719-llvm-d89a6e11a78c781184544c05e2619c4d010718d6.tar.gz bcm5719-llvm-d89a6e11a78c781184544c05e2619c4d010718d6.zip |
InferAddressSpaces: Don't replace volatile users
llvm-svn: 293582
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index 8ca35c0061f..46f06090f96 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -570,8 +570,11 @@ bool InferAddressSpaces::rewriteWithNewAddressSpaces( << "\n with\n " << *NewV << '\n'); for (Use *U : Uses) { - if (isa<LoadInst>(U->getUser()) || - (isa<StoreInst>(U->getUser()) && + LoadInst *LI = dyn_cast<LoadInst>(U->getUser()); + StoreInst *SI = dyn_cast<StoreInst>(U->getUser()); + + if ((LI && !LI->isVolatile()) || + (SI && !SI->isVolatile() && U->getOperandNo() == StoreInst::getPointerOperandIndex())) { // If V is used as the pointer operand of a load/store, sets the pointer // operand to NewV. This replacement does not change the element type, |