[PATCH] D12016: [SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.

Bjarke Hammersholt Roune via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 14:47:40 PDT 2015


broune added inline comments.

================
Comment at: lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp:1098
@@ +1097,3 @@
+
+  // Add I to DominatingExprs if it's a add/sub that can't sign overflow.
+  if (match(I, m_NSWAdd(m_Value(LHS), m_Value(RHS))) ||
----------------
a -> an

================
Comment at: lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp:1101
@@ +1100,3 @@
+      match(I, m_NSWSub(m_Value(LHS), m_Value(RHS)))) {
+    if (isKnownNotFullPoison(I)) {
+      const SCEV *Key =
----------------
I think that you also need to check that I has a NSW or NUW flag.

I wonder if it would be faster to insert all the add/sub dominators with such a flag and then check isKnownNotFullPoison(I) only when an instruction is returned from findClosestMatchingDominator().


http://reviews.llvm.org/D12016





More information about the llvm-commits mailing list