diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-01-29 22:33:20 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-01-29 22:33:20 +0000 |
commit | f9027e554a6270ccaec1219ed2c0c194504905db (patch) | |
tree | 53676914bd402a522e999902840a0796bf8d5bd6 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | 37b4ee523bd94da3cf61246fa735522fff248423 (diff) | |
download | bcm5719-llvm-f9027e554a6270ccaec1219ed2c0c194504905db.tar.gz bcm5719-llvm-f9027e554a6270ccaec1219ed2c0c194504905db.zip |
Check bool attribute value in getOptionalBoolLoopAttribute.
Summary:
Check the bool value of the attribute in getOptionalBoolLoopAttribute
not just its existance.
Eliminates the warning noise generated when vectorization is explicitly disabled.
Reviewers: Meinersbur, hfinkel, dmgreen
Subscribers: jlebar, sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D57260
llvm-svn: 352555
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 3d08ce21f31..54cb0fc23cb 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -216,7 +216,10 @@ static Optional<bool> getOptionalBoolLoopAttribute(const Loop *TheLoop, // When the value is absent it is interpreted as 'attribute set'. return true; case 2: - return mdconst::extract_or_null<ConstantInt>(MD->getOperand(1).get()); + if (ConstantInt *IntMD = + mdconst::extract_or_null<ConstantInt>(MD->getOperand(1).get())) + return IntMD->getZExtValue(); + return true; } llvm_unreachable("unexpected number of options"); } |