diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-04-12 22:29:23 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-04-12 22:29:23 +0000 |
commit | 854824139e4f7db8513dea19933d1cf5b5c97796 (patch) | |
tree | e612ffe14b49c96f1b474ded4ac0316b01bf320c /llvm/lib/Analysis/ValueTracking.cpp | |
parent | ec0fc037af27a882aec393e024b7a1f49339c3e8 (diff) | |
download | bcm5719-llvm-854824139e4f7db8513dea19933d1cf5b5c97796.tar.gz bcm5719-llvm-854824139e4f7db8513dea19933d1cf5b5c97796.zip |
[ValueTracking] Teach GetUnderlyingObject to stop when it reachs an alloca instruction.
Previously it tried to call SimplifyInstruction which doesn't know anything about alloca so defers to constant folding which also doesn't do anything with alloca. This results in wasted cycles making calls that won't do anything. Given the frequency with which this function is called this time adds up.
llvm-svn: 300118
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index d4c0e7092ea..0309afd98af 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3216,6 +3216,9 @@ Value *llvm::GetUnderlyingObject(Value *V, const DataLayout &DL, if (GA->isInterposable()) return V; V = GA->getAliasee(); + } else if (isa<AllocaInst>(V)) { + // An alloca can't be further simplified. + return V; } else { if (auto CS = CallSite(V)) if (Value *RV = CS.getReturnedArgOperand()) { |