[PATCH] IR: Fold away compares between GV GEPs and GVs

Nick Lewycky nlewycky at google.com
Fri Jul 4 11:54:10 PDT 2014


================
Comment at: lib/IR/ConstantFold.cpp:1339
@@ +1338,3 @@
+                                                      const GlobalValue *GV2) {
+  // Don't try to decide equality of aliases.
+  if (!isa<GlobalAlias>(GV1) && !isa<GlobalAlias>(GV2))
----------------
(No action required:) I realize this is copied from elsewhere, but I don't see why we can't follow non-weak aliases as long as they point to definitions.

================
Comment at: lib/IR/ConstantFold.cpp:1538
@@ +1537,3 @@
+            if (CE1Op0 != CE2Op0) {
+              GEPOperator *CE2GEP = cast<GEPOperator>(CE2);
+              if (CE1GEP->hasAllZeroIndices() && CE2GEP->hasAllZeroIndices())
----------------
// Don't know relative ordering, but check for inequality.

http://reviews.llvm.org/D4238






More information about the llvm-commits mailing list