summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2013-02-01 00:49:06 +0000
committerDan Gohman <dan433584@gmail.com>2013-02-01 00:49:06 +0000
commit9631d908b01f65d1ffffed82c2d873cc280c4b2f (patch)
tree081711245c021a2f294b3b73f7f1ca9a1f0d462c /llvm/lib/Analysis/InstructionSimplify.cpp
parent3f9fcd48a4d4556e70c346fb9d2769302313e83b (diff)
downloadbcm5719-llvm-9631d908b01f65d1ffffed82c2d873cc280c4b2f.tar.gz
bcm5719-llvm-9631d908b01f65d1ffffed82c2d873cc280c4b2f.zip
Add a comment explaining an unavailable optimization.
llvm-svn: 174131
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 2ca37cc3458..e296215442c 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1688,6 +1688,34 @@ static Value *ExtractEquivalentCondition(Value *V, CmpInst::Predicate Pred,
return 0;
}
+// A significant optimization not implemented here is assuming that alloca
+// addresses are not equal to incoming argument values. They don't *alias*,
+// as we say, but that doesn't mean they aren't equal, so we take a
+// conservative approach.
+//
+// This is inspired in part by C++11 5.10p1:
+// "Two pointers of the same type compare equal if and only if they are both
+// null, both point to the same function, or both represent the same
+// address."
+//
+// This is pretty permissive.
+//
+// It's also partly due to C11 6.5.9p6:
+// "Two pointers compare equal if and only if both are null pointers, both are
+// pointers to the same object (including a pointer to an object and a
+// subobject at its beginning) or function, both are pointers to one past the
+// last element of the same array object, or one is a pointer to one past the
+// end of one array object and the other is a pointer to the start of a
+// different array object that happens to immediately follow the first array
+// object in the address space.)
+//
+// C11's version is more restrictive, however there's no reason why an argument
+// couldn't be a one-past-the-end value for a stack object in the caller and be
+// equal to the beginning of a stack object in the callee.
+//
+// If the C and C++ standards are ever made sufficiently restrictive in this
+// area, it may be possible to update LLVM's semantics accordingly and reinstate
+// this optimization.
static Constant *computePointerICmp(const DataLayout *TD,
const TargetLibraryInfo *TLI,
CmpInst::Predicate Pred,
OpenPOWER on IntegriCloud