aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-07-13 21:25:33 +0000
committerPete Cooper <peter_cooper@apple.com>2015-07-13 21:25:33 +0000
commit90d95edbb4ed7588d62d8187902dd331e897ef4b (patch)
tree1c5b1276deb9d7a4b6ed3729608ce168e017a4f8 /clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
parent7227a88f2327aeb7c7c41fbe4c8117645151f8ba (diff)
downloadllvm-90d95edbb4ed7588d62d8187902dd331e897ef4b.zip
llvm-90d95edbb4ed7588d62d8187902dd331e897ef4b.tar.gz
llvm-90d95edbb4ed7588d62d8187902dd331e897ef4b.tar.bz2
Loop idiom recognizer was replacing too many uses of popcount.
When spotting that a loop can use ctpop, we were incorrectly replacing all uses of a value with a value derived from ctpop. The bug here was exposed because we were replacing a use prior to the ctpop with the ctpop value and so we have a use before def, i.e., we changed %tobool.5 = icmp ne i32 %num, 0 store i1 %tobool.5, i1* %ptr br i1 %tobool.5, label %for.body.lr.ph, label %for.end to store i1 %1, i1* %ptr %0 = call i32 @llvm.ctpop.i32(i32 %num) %1 = icmp ne i32 %0, 0 br i1 %1, label %for.body.lr.ph, label %for.end Even if we inserted the ctpop so that it dominates the store here, that would still be incorrect. The store doesn’t want the result of ctpop. The fix is very simple, and involves replacing only the branch condition with the ctpop instead of all uses. Reviewed by Hal Finkel. llvm-svn: 242068
Diffstat (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp')
0 files changed, 0 insertions, 0 deletions