https://llvm.org/bugs/show_bug.cgi?id=30597
Bug ID: 30597 Summary: instcombine drops load !nonnull metadata on an inttoptr/ptrtoint Product: libraries Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: arie...@mail.tau.ac.il CC: llvm-bugs@lists.llvm.org Classification: Unclassified ## Description When instcombine simplifies a inttoptr/ptrtoint pair that covers a load, !nonnull metadata on the load seems to be dropped on the floor, leading to missed optimizations. This is one of the causes of https://github.com/rust-lang/rust/issues/36920 (the current version of rustc does not emit the required nonnull metadata, but modifying it to emit the metadata leads to this issue). Tested on Rust's fork of LLVM 3.9 and Debian's LLVM 3.7. ## STR ; ModuleID = 'test.cgu-0.rs' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: readonly uwtable define i32 @dot_ref_s(i32** noalias nocapture readonly dereferenceable(8)) { entry-block: %loadedptr = load i32*, i32** %0, align 8, !nonnull !0 %ptrtoint = ptrtoint i32* %loadedptr to i64 %inttoptr = inttoptr i64 %ptrtoint to i32* %switchtmp = icmp eq i32* %inttoptr, null br i1 %switchtmp, label %bb6, label %bb7 bb6: ret i32 0 bb7: ret i32 42 } !0 = !{} ## Expected Result The null check is optimized out. ## Actual Result ; ModuleID = '<stdin>' source_filename = "test.cgu-0.rs" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @dot_ref_s(i32** noalias nocapture readonly dereferenceable(8)) { entry-block: %loadedptr12 = load i32*, i32** %0, align 8 ; <- where is my metadata? %switchtmp = icmp eq i32* %loadedptr12, null br i1 %switchtmp, label %bb6, label %bb7 bb6: ; preds = %entry-block ret i32 0 bb7: ; preds = %entry-block ret i32 42 } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs