[PATCH] D92698: Add recursive decomposition reasoning to isKnownNonEqual

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 5 02:59:38 PST 2020


nikic added a comment.

> We have analogous handling in InstSimplify for most - though weirdly not all - of these cases starting from an icmp root. It's a bit unfortunate to duplicate logic, but since my actual goal is to extend BasicAA, the icmp logic doesn't help. (And just makes it hard to test here.)

Could you add some tests for the BasicAA use case? If that's the intended target, I'm not sure this is the right approach. Currently the BasicAA logic for the non-equal index case is structural, while it should really be based on the index difference of decomposed GEP expressions. I suspect that handling it that way may also handle your motivating case, as e.g. common add operands would get stripped by that.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2536
+    case Instruction::IntToPtr:
+    case Instruction::PtrToInt:
+      if (O1->getOperand(0)->getType() == O2->getOperand(0)->getType())
----------------
IntToPtr/PtrToInt can truncate, you need to check bit widths here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92698/new/

https://reviews.llvm.org/D92698



More information about the llvm-commits mailing list