Reassociate reports change made incorrectly
| Bugzilla Link | 28208 |
| Version | trunk |
| OS | All |
| CC | @hfinkel,@sanjoy |
Extended Description
Reassociate pass returns true with no change made on the following function: define i64 @test(i64 %a, i64 %b) { %1 = and i64 %b, %a ret i64 %1 }
opt -S reassociate.ll -reassociate -debug-pass=Executions
[2016-06-20 08:55:35.332437000] 0x1906670 Executing Pass 'Function Pass Manager' on Module 'simple.ll'... [2016-06-20 08:55:35.332704000] 0x1908770 Executing Pass 'Reassociate expressions' on Function 'test'... [2016-06-20 08:55:35.333682000] 0x1908770 Made Modification 'Reassociate expressions' on Function 'test'... [2016-06-20 08:55:35.333792000] 0x1908770 Freeing Pass 'Reassociate expressions' on Function 'test'... [2016-06-20 08:55:35.333837000] 0x1908770 Executing Pass 'Module Verifier' on Function 'test'... [2016-06-20 08:55:35.334012000] 0x1908770 Freeing Pass 'Module Verifier' on Function 'test'... [2016-06-20 08:55:35.334048000] 0x1906670 Made Modification 'Function Pass Manager' on Module 'simple.ll'... [2016-06-20 08:55:35.334077000] 0x1906670 Executing Pass 'Print module to stderr' on Module 'simple.ll'...
It happens because it performs two distinct transformations which nullify each other (canonicalizeOperands swaps arguments of an and and then ReassociateExpression swaps them back).