summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2018-08-16 20:48:55 +0000
committerPhilip Reames <listmail@philipreames.com>2018-08-16 20:48:55 +0000
commit684fa57ef7c1b58998afeec7298b8a861049a2dd (patch)
tree59cb171c1c761b0428bbbadb9ff9426dcc4c750c /llvm/lib
parent8bb383f1fbb83588fe901a507e485254256886ed (diff)
downloadbcm5719-llvm-684fa57ef7c1b58998afeec7298b8a861049a2dd.tar.gz
bcm5719-llvm-684fa57ef7c1b58998afeec7298b8a861049a2dd.zip
[MemLoc] Fix a bug causing any use of invariant.end to crash in LICM
The fix is fairly simple, but is says something unpleasant about the usage and testing of invariant.start/end scopes that this went undetected. To put this in perspective, *any* invariant.end in a loop flowing through LICM crashed. I haven't bothered to figure out just how far back this goes, but it's not caused by any of the recent changes. We're probably talking months if not years. llvm-svn: 339936
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/MemoryLocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index 55924db284e..43cebcd7a30 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -137,6 +137,10 @@ MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS,
Arg, cast<ConstantInt>(II->getArgOperand(0))->getZExtValue(), AATags);
case Intrinsic::invariant_end:
+ // The first argument to an invariant.end is a "descriptor" type (e.g. a
+ // pointer to a empty struct) which is never actually dereferenced.
+ if (ArgIdx == 0)
+ return MemoryLocation(Arg, 0, AATags);
assert(ArgIdx == 2 && "Invalid argument index");
return MemoryLocation(
Arg, cast<ConstantInt>(II->getArgOperand(1))->getZExtValue(), AATags);
OpenPOWER on IntegriCloud