diff options
author | Owen Anderson <resistor@mac.com> | 2011-07-01 21:52:38 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2011-07-01 21:52:38 +0000 |
commit | f1ac465b67d5fc11a0d9cd09b98ceb4ffa75dd97 (patch) | |
tree | aaf9703560cbff74cd01b5aec6cd06a8048066fe /lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | adebeeaaee830a3704e207ed8216d3d10b6f1b3d (diff) | |
download | external_llvm-f1ac465b67d5fc11a0d9cd09b98ceb4ffa75dd97.zip external_llvm-f1ac465b67d5fc11a0d9cd09b98ceb4ffa75dd97.tar.gz external_llvm-f1ac465b67d5fc11a0d9cd09b98ceb4ffa75dd97.tar.bz2 |
Generalize @llvm.ctlz, @llvm.cttz, and @llvm.ctpop to work on vectors of integers, and fix the one optimization pass that I'm aware of that needs updating for this. At least one current target, ARM NEON, can implement these operations on vectors directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCalls.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 455cd0a..27e15c3 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -355,7 +355,9 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { case Intrinsic::cttz: { // If all bits below the first known one are known zero, // this value is constant. - const IntegerType *IT = cast<IntegerType>(II->getArgOperand(0)->getType()); + const IntegerType *IT = dyn_cast<IntegerType>(II->getArgOperand(0)->getType()); + // FIXME: Try to simplify vectors of integers. + if (!IT) break; uint32_t BitWidth = IT->getBitWidth(); APInt KnownZero(BitWidth, 0); APInt KnownOne(BitWidth, 0); @@ -372,7 +374,9 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { case Intrinsic::ctlz: { // If all bits above the first known one are known zero, // this value is constant. - const IntegerType *IT = cast<IntegerType>(II->getArgOperand(0)->getType()); + const IntegerType *IT = dyn_cast<IntegerType>(II->getArgOperand(0)->getType()); + // FIXME: Try to simplify vectors of integers. + if (!IT) break; uint32_t BitWidth = IT->getBitWidth(); APInt KnownZero(BitWidth, 0); APInt KnownOne(BitWidth, 0); |