Skip to content
  1. Feb 14, 2010
  2. Feb 13, 2010
  3. Feb 12, 2010
  4. Feb 11, 2010
  5. Feb 10, 2010
  6. Feb 09, 2010
  7. Feb 06, 2010
  8. Feb 05, 2010
    • Jakob Stoklund Olesen's avatar
      Teach SimplifyCFG about magic pointer constants. · 916f48a0
      Jakob Stoklund Olesen authored
      Weird code sometimes uses pointer constants other than null. This patch
      teaches SimplifyCFG to build switch instructions in those cases.
      
      Code like this:
      
      void f(const char *x) {
        if (!x)
          puts("null");
        else if ((uintptr_t)x == 1)
          puts("one");
        else if (x == (char*)2 || x == (char*)3)
          puts("two");
        else if ((intptr_t)x == 4)
          puts("four");
        else
          puts(x);
      }
      
      Now becomes a switch:
      
      define void @f(i8* %x) nounwind ssp {
      entry:
        %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
        switch i64 %magicptr23, label %if.else16 [
          i64 0, label %if.then
          i64 1, label %if.then2
          i64 2, label %if.then9
          i64 3, label %if.then9
          i64 4, label %if.then14
        ]
      
      Note that LLVM's own DenseMap uses magic pointers.
      
      llvm-svn: 95439
      916f48a0
    • Chris Lattner's avatar
      fix logical-select to invoke filecheck right, and fix hte instcombine · 64ffd11d
      Chris Lattner authored
      xform it is checking to actually pass.  There is no need to match
      m_SelectCst<0, -1> since instcombine canonicalizes that into not(sext).
      
      Add matches for sext(not(x)) in addition to not(sext(x)).
      
      llvm-svn: 95420
      64ffd11d
Loading