diff options
| author | Lang Hames <lhames@gmail.com> | 2013-10-28 20:51:11 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2013-10-28 20:51:11 +0000 |
| commit | b52816615b64740b8f33b31adc620c8262ad3556 (patch) | |
| tree | c04f2e5bc3bb23d82420c69916316d38ab3f50a3 /llvm/lib/Target/ARM | |
| parent | 889a180e5a9e4f3958e62438d881fd73c2c5e594 (diff) | |
| download | bcm5719-llvm-b52816615b64740b8f33b31adc620c8262ad3556.tar.gz bcm5719-llvm-b52816615b64740b8f33b31adc620c8262ad3556.zip | |
Return early from getUnconditionalBranchTargetOpValue if the branch target is
an MCExpr, in order to avoid writing an encoded zero value in the immediate
field.
When getUnconditionalBranchTargetOpValue is called with an MCExpr target, we
don't know what the final immediate field value should be. We shouldn't
explicitly set the immediate field to an encoded zero value as zero is encoded
with a non-zero bit pattern. This leads to bits being set that pollute the
final immediate value. The nature of the encoding is such that the polluted
bits only affect very large immediate values, explaining why this hasn't
caused problems earlier.
Fixes <rdar://problem/15155975>.
llvm-svn: 193535
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp index e4c37276493..4382d0d9714 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp @@ -641,7 +641,7 @@ getUnconditionalBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, const MCOperand MO = MI.getOperand(OpIdx); if(MO.isExpr()) - Val = ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_t2_uncondbranch, Fixups); + return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_t2_uncondbranch, Fixups); else Val = MO.getImm() >> 1; |

