[PATCH] D33257: [JumpThreading] Dont RAUW condition if guards in block

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 05:40:49 PDT 2017


anna added inline comments.


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:270
+    // two levels of uses, just check for presence of guards within the basic block.
+    auto *BB = Cond->getParent();
+    for (auto &I: *BB)
----------------
mkazantsev wrote:
> Should we check all dominating blocks as well?
No, we don't need to check blocks dominating BB because the bug occurs when guard/assume *use* the `Cond`. Since defs dominate uses, we are fine.
Also, we don't need to check for uses  in blocks dominated by `BB` because starting from the point of BB's terminator (i.e. the context instruction passed into LVI) and iterating forward, we can safely replace the uses of `Cond` with `Val` (returned by LVI). 

The issue is when we try to replaces uses within the block BB where `Cond` is defined.


https://reviews.llvm.org/D33257





More information about the llvm-commits mailing list