[llvm-commits] [PATCH] instcombine: Don't replace all uses for instructions with no uses
Eli Friedman
eli.friedman at gmail.com
Tue Nov 27 10:48:46 PST 2012
On Tue, Nov 27, 2012 at 9:57 AM, Meador Inge <meadori at codesourcery.com> wrote:
> My commit to migrate the printf simplifiers from the simplify-libcalls
> in r168604 introduced a regression reported by Duncan [1]. The problem
> is that in some cases the library call simplifier can return a new value
> that has no uses and the new value's type is different than the old value's
> type (which is fine because there are no uses). The specific case that
> triggered the bug looked something like:
>
> declare void @printf(i8*, ...)
> ...
> call void (i8*, ...)* @printf(i8* %fmt)
>
> Which we want to optimized into:
>
> call i32 @putchar(i32 104)
>
> However, the code was attempting to replace all uses of the printf with
> the putchar and the types differ, hence a crash. This is fixed by *just*
> deleting the original instruction when there are no uses. The old
> simplify-libcalls pass is already doing something similar.
>
> OK?
Yes, fine.
-Eli
More information about the llvm-commits
mailing list