aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-07-14 17:48:25 +0000
committerDale Johannesen <dalej@apple.com>2009-07-14 17:48:25 +0000
commitfa196e34b0676a48d824c8feb29c6ca016667025 (patch)
tree954c7a5b92b524131a7bd4d9864d47f1fa84ab5d
parentc23197a26f34f559ea9797de51e187087c039c42 (diff)
Revert 75571; I'm convinced this isn't the right thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75642 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/SimplifyCFGPass.cpp25
-rw-r--r--test/Transforms/SimplifyCFG/2009-07-13-no-delete-asm.ll11
2 files changed, 8 insertions, 28 deletions
diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 155d5d81e3..f6cffdd0ef 100644
--- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -109,8 +109,6 @@ static bool MarkAliveBlocks(BasicBlock *BB,
if (!Reachable.insert(BB))
continue;
- bool AsmFound = false;
- StoreInst *UndefStore = 0;
// Do a quick scan of the basic block, turning any obviously unreachable
// instructions into LLVM unreachable insts. The instruction combining pass
// canonicalizes unreachable insts into stores to null or undef.
@@ -127,27 +125,20 @@ static bool MarkAliveBlocks(BasicBlock *BB,
}
break;
}
- if (isa<InlineAsm>(CI->getOperand(0)))
- AsmFound = true;
}
if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
Value *Ptr = SI->getOperand(1);
-
- if ((isa<UndefValue>(Ptr) ||
- (isa<ConstantPointerNull>(Ptr) &&
- cast<PointerType>(Ptr->getType())->getAddressSpace() == 0)) &&
- !UndefStore)
- UndefStore = SI;
+
+ if (isa<UndefValue>(Ptr) ||
+ (isa<ConstantPointerNull>(Ptr) &&
+ cast<PointerType>(Ptr->getType())->getAddressSpace() == 0)) {
+ ChangeToUnreachable(SI, Context);
+ Changed = true;
+ break;
+ }
}
}
- // We can't delete asm's just because their inputs are undefined;
- // xor R, R is a common idiom for zeroing a register, for example.
- // Assume user knows what he is doing.
- if (UndefStore && !AsmFound) {
- ChangeToUnreachable(UndefStore, Context);
- Changed = true;
- }
// Turn invokes that call 'nounwind' functions into ordinary calls.
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
diff --git a/test/Transforms/SimplifyCFG/2009-07-13-no-delete-asm.ll b/test/Transforms/SimplifyCFG/2009-07-13-no-delete-asm.ll
deleted file mode 100644
index 4664ee0348..0000000000
--- a/test/Transforms/SimplifyCFG/2009-07-13-no-delete-asm.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep xor
-; ModuleID = '<stdin>'
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
-target triple = "i386-apple-darwin9.6"
-
-define void @bar() nounwind {
-entry:
- store i16 undef, i16* null
- %asmtmp = call i32 asm sideeffect "xor $0, $0", "=={bx},rm,~{dirflag},~{fpsr},~{flags},~{memory}"(i16 undef) nounwind ; <i32> [#uses=0]
- ret void
-}