[LLVMbugs] [Bug 13727] New: Target constant materialization in fast-isel doesn't handle non-small code model reliably

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 29 17:05:05 PDT 2012


             Bug #: 13727
           Summary: Target constant materialization in fast-isel doesn't
                    handle non-small code model reliably
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: michael.liao at intel.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9135
  --> http://llvm.org/bugs/attachment.cgi?id=9135
test case triggering this issue

the attached test case crash on 64-bit Linux (LLVM trunk r) with the following

$ lli -use-mcjit -O0 bug.ll 
void llvm::RuntimeDyldELF::resolveX86_64Relocation(uint8_t*, uint64_t,
uint64_t, uint32_t, int64_t): Assertion `(Type == ELF::R_X86_64_32 && (Value <=
(4294967295U))) || (Type == ELF::R_X86_64_32S && ((int64_t)Value <=
(2147483647) && (int64_t)Value >= (-2147483647-1)))' failed.
Stack dump:
0.    Program arguments: lli -use-mcjit -O0 bug.ll 
Aborted (core dumped)

The assertion reports an overflow of a 32-bit relative addressing even though
MCJIT is designed to use large code model.

After investigation, it's turned out that target constant materialization in
x86's fast-isel doesn't handle large code model reliably by generate
PC-relative addressing which trigger this assertion when .rodata section is
allocated faraway from code segment.

(PS: the test case is generated by copying
test/ExecutionEngine/MCJIT/test-common-symbols.ll and applying the following
patch, i.e. changing constant 1.0 to 1.1

$ diff -u test/ExecutionEngine/MCJIT/test-common-symbols.ll bug.ll 
--- test/ExecutionEngine/MCJIT/test-common-symbols.ll    2012-08-29
16:32:56.632968836 -0700
+++ bug.ll    2012-08-29 16:54:02.612934213 -0700
@@ -37,7 +37,7 @@
   %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64
   store i32 40, i32* %arrayidx, align 4
   %1 = load double* @zero_double, align 8
-  %cmp = fcmp olt double %1, 1.000000e+00
+  %cmp = fcmp olt double %1, 1.100000e+00
   br i1 %cmp, label %if.then, label %if.end

 if.then:                                          ; preds = %entry


Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list