diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/SimplifyLibCalls/FFS.ll | 6 | 
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp index d53bc3f0ccc..8c41c728c06 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -1116,7 +1116,7 @@ struct VISIBILITY_HIDDEN FFSOpt : public LibCallOptimization {      Value *F = Intrinsic::getDeclaration(Callee->getParent(),                                           Intrinsic::cttz, &ArgType, 1);      Value *V = B.CreateCall(F, Op, "cttz"); -    V = B.CreateAdd(V, ConstantInt::get(Type::Int32Ty, 1), "tmp"); +    V = B.CreateAdd(V, ConstantInt::get(V->getType(), 1), "tmp");      V = B.CreateIntCast(V, Type::Int32Ty, false, "tmp");      Value *Cond = B.CreateICmpNE(Op, Constant::getNullValue(ArgType), "tmp"); diff --git a/llvm/test/Transforms/SimplifyLibCalls/FFS.ll b/llvm/test/Transforms/SimplifyLibCalls/FFS.ll index bdf43ef69f7..d6a504af867 100644 --- a/llvm/test/Transforms/SimplifyLibCalls/FFS.ll +++ b/llvm/test/Transforms/SimplifyLibCalls/FFS.ll @@ -28,3 +28,9 @@ define i32 @main() {  	ret i32 %rslt5  } + +; PR4206 +define i32 @a(i64) nounwind { +        %2 = call i32 @ffsll(i64 %0)            ; <i32> [#uses=1] +        ret i32 %2 +}  | 

