canonicalize:
authorNuno Lopes <nunoplopes@sapo.pt>
Fri, 8 Jun 2012 22:30:05 +0000 (22:30 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Fri, 8 Jun 2012 22:30:05 +0000 (22:30 +0000)
commit0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92
treea165987d68fc44ff8f75bc5e685784f4f66b6ab5
parent791e2e0867d1e6fcb9c6f651da89f57043bc6c4a
canonicalize:
-%a + 42
into
42 - %a

previously we were emitting:
-(%a + 42)

This fixes the infinite loop in PR12338. The generated code is still not perfect, though.
Will work on that next

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158237 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/pr12338.ll [new file with mode: 0644]