mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 13:21:43 +00:00
Fix DSE to not eliminate volatile loads with no uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
beb5be0332
commit
00acf97feb
@ -326,9 +326,9 @@ bool DSE::handleEndBlock(BasicBlock& BB,
|
||||
|
||||
// If we encounter a use of the pointer, it is no longer considered dead
|
||||
if (LoadInst* L = dyn_cast<LoadInst>(BBI)) {
|
||||
// However, if this load is unused, we can go ahead and remove it, and
|
||||
// not have to worry about it making our pointer undead!
|
||||
if (L->use_empty()) {
|
||||
// However, if this load is unused and not volatile, we can go ahead and remove it,
|
||||
// and not have to worry about it making our pointer undead!
|
||||
if (L->use_empty() && !L->isVolatile()) {
|
||||
MD.removeInstruction(L);
|
||||
|
||||
// DCE instructions only used to calculate that load
|
||||
|
8
test/Transforms/DeadStoreElimination/volatile-load.ll
Normal file
8
test/Transforms/DeadStoreElimination/volatile-load.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {volatile load}
|
||||
|
||||
@g_1 = global i32 0
|
||||
|
||||
define void @foo() nounwind {
|
||||
%t = volatile load i32* @g_1
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user