[JumpThreading] make jump threading respect convergent annotation.
authorJingyue Wu <jingyue@google.com>
Mon, 31 Aug 2015 06:10:27 +0000 (06:10 +0000)
committerJingyue Wu <jingyue@google.com>
Mon, 31 Aug 2015 06:10:27 +0000 (06:10 +0000)
commit0a613536b19d90e12e87154345b083d8f2e28e80
treef33af47dd1068d9acd4a8c09f2314b78a77734fe
parent42829a5316b507a78f4c9d53890718bf6bf7b95e
[JumpThreading] make jump threading respect convergent annotation.

Summary:
JumpThreading shouldn't duplicate a convergent call, because that would move a convergent call into a control-inequivalent location. For example,
  if (cond) {
    ...
  } else {
    ...
  }
  convergent_call();
  if (cond) {
    ...
  } else {
    ...
  }
should not be optimized to
  if (cond) {
    ...
    convergent_call();
    ...
  } else {
    ...
    convergent_call();
    ...
  }

Test Plan: test/Transforms/JumpThreading/basic.ll

Patch by Xuetian Weng.

Reviewers: resistor, arsenm, jingyue

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12484

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246415 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instructions.h
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/JumpThreading/basic.ll