[PATCH] D20847: BitCast infinite loop fix

Evgeny Stupachenko via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 12:45:14 PDT 2016


evstupac added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1816-1825
@@ +1815,12 @@
+  bool Store = false;
+  for (User *U : PN->users()) {
+    auto *SI = dyn_cast<StoreInst>(U);
+    if (SI && SI->isSimple() && SI->getOperand(0) == PN)
+      Store = true;
+  }
+  for (User *U : CI.users()) {
+    auto *SI = dyn_cast<StoreInst>(U);
+    if (SI && SI->isSimple() && SI->getOperand(0) == &CI && Store)
+      return nullptr;
+  }
+
----------------
majnemer wrote:
> Could a problem arise if this phi was used by a phi?
No.
We add new BitCast at the end only if PN->uses() has store (line 1913).
Here I'm looking for "store" in the same PN->uses().


Repository:
  rL LLVM

http://reviews.llvm.org/D20847





More information about the llvm-commits mailing list