[PATCH] D29213: InferAddressSpaces: Handle icmp

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 10:38:45 PST 2017


jlebar added a comment.

Just so I know how to read these tests: AS(4) is the flat AS?



================
Comment at: lib/Transforms/Scalar/InferAddressSpaces.cpp:759
+            if (KOtherSrc->getType()->getPointerAddressSpace() == NewAS ||
+                isa<UndefValue>(KOtherSrc)) {
+              Cmp->setOperand(SrcIdx, NewV);
----------------
Can we have a test for `icmp x, undef` and `icmp undef, x`?


================
Comment at: lib/Transforms/Scalar/InferAddressSpaces.cpp:762
+              Cmp->setOperand(OtherIdx,
+                ConstantExpr::getAddrSpaceCast(KOtherSrc, NewV->getType()));
+              continue;
----------------
If KOtherSrc->AS() == NewAS, then isn't this ASC redundant?  It seems we should only need it if KOtherSrc is undef, and in that case, can we just substitute a new undef value, instead of ASC'ing the old undef?


https://reviews.llvm.org/D29213





More information about the llvm-commits mailing list