IR: Reduce RAUW traffic in ConstantExpr
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 01:12:53 +0000 (01:12 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 01:12:53 +0000 (01:12 +0000)
commit1cfbb6358c2fc6c6cdf1a012c64cf23d3f859662
tree91dcd5c1f62021a6d1d747869cb570f29ab4367e
parentfe0bf8fbf9d401a67a1842da6cefbb58aa8975a3
IR: Reduce RAUW traffic in ConstantExpr

Avoid RAUW-ing `ConstantExpr` when an operand changes unless the new
`ConstantExpr` already has users.  This prevents the RAUW from rippling
up the expression tree unnecessarily.

This commit indirectly adds test coverage for r215953 (this is how I
came across the bug).

This is part of PR20515.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215960 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Constants.h
lib/IR/Constants.cpp