[PATCH] D23312: [Thumb] Validate branch target for CBZ/CBNZ instructions.
Oliver Stannard via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 9 05:40:24 PDT 2016
olista01 added a subscriber: olista01.
================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:863
@@ -862,1 +862,3 @@
+ bool isPositiveOffset() const {
+ if (!isImm()) return false;
----------------
Why don't you use isUnsignedOffset, which would also check the upper limit and alignment?
================
Comment at: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp:582
@@ +581,3 @@
+ // CB instructions cannot branch backwards with a negative offset
+ if (Ctx && (int64_t)Value < 0) {
+ Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");
----------------
We should also check the upper bound and alignment here.
Repository:
rL LLVM
https://reviews.llvm.org/D23312
More information about the llvm-commits
mailing list